You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
549 B
12 lines
549 B
5 years ago
|
// startsWith: it takes a substring as an argument and it checks if the string starts with that specified substring. It returns a boolean(true or false).
|
||
|
// string.startsWith(substring)
|
||
|
let string = 'Love is the best to in this world'
|
||
|
console.log(string.startsWith('Love')) // true
|
||
|
console.log(string.startsWith('love')) // false
|
||
|
console.log(string.startsWith('world')) // false
|
||
|
|
||
|
let country = 'Finland'
|
||
|
console.log(country.startsWith('Fin')) // true
|
||
|
console.log(country.startsWith('fin')) // false
|
||
|
console.log(country.startsWith('land')) // false
|