One thing that mildly irks me about W3Schools is that it has a streak counter for how many days you've been learning. But it takes the weekend into account for that streak, so, unsurprisingly, I keep resetting my streak. I'm sorry, the weekends are not for JavaScript. The weekends are for cheesy travelogues and going out to goth club nights. JavaScript String Search MethodsSo these are ways you can search through strings. I'm going to do the same thing I did with the string methods and go through each one with ridiculous examples. Thankfully there are less of these. Index Of'indexOf()' gives you the position of the first time it finds what you're looking for. let sample = `Pikachu, Charmander, Squirtle, Bulbasaur, Magikarp, Mimikyu.`; let magikarp = sample.indexOf("Magikarp"); And, yep, it tells me that Magikarp starts at 42. And when I do let sample = `Pikachu, Charmander, Squirtle, Bulbasaur, Magikarp, Mimikyu.`; let eevee = sample.indexOf("Eevee"); it gives me the -1 that I'm…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.