DEV Community

loading...

Discussion on: Day 12 - Making A Search Function: Rest Countries Part II

Collapse
katylava profile image
katy lavallee

You can also use your initial indexOf way, but compare as === 0 instead of !== 1, unless I'm missing something.

Collapse
joanne profile image
Joanne Author

Ah yes, indexOf always starts at 0! Since I wanted to look at the beginning of string for the characters, this is a much shorter way to write out my search function. Thanks!