Last active
January 22, 2019 09:00
-
-
Save PierraKimathi-zz/dc3c219fdf6f4c4121dcff3cf83dff07 to your computer and use it in GitHub Desktop.
Find the word needle in a list
This file contains hidden or 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
function find_needle(haystack) { | |
var needleIndex = haystack.IndexOf('needle'); | |
return 'found the needle at position' + needleIndex; | |
} | |
find_needle(['hay', 'junk', 'hay', 'hay', 'moreJunk', 'needle', 'randomJunk']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment