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.
7 lines
408 B
7 lines
408 B
// lastIndexOf(): Takes takes a substring and if the substring exists in a string it returns the last position of the substring if it does not exist it returns -1
|
|
|
|
let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
|
|
console.log(string.lastIndexOf('love')) // 67
|
|
console.log(string.lastIndexOf('you')) // 63
|
|
console.log(string.lastIndexOf('JavaScript')) // 38
|