Created
March 27, 2019 14:13
-
-
Save Chuloo/710066198c067d17045b34b57bc486ea to your computer and use it in GitHub Desktop.
The last "the"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// New string | |
const words = "the house, the car, the book, the mac and the cheese" | |
// Specify search item | |
const searchTerm = "the" | |
// Search the string | |
let lastIndexOfWord = words.lastIndexOf(searchTerm) | |
// Display last index | |
console.log(lastIndexOfWord) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment