Created
June 23, 2021 08:20
-
-
Save emmabostian/660f5d49591e7008066e86aac041a2fc to your computer and use it in GitHub Desktop.
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 iterate(arr, findMe) { | |
if (arr[0]) { | |
if(arr[0] === findMe) { | |
return true; | |
} | |
} | |
if (arr[1]) { | |
if (arr[1] === findMe) { | |
return true; | |
} | |
} | |
if (arr[2]) { | |
if (arr[2] === findMe) { | |
return true; | |
} | |
} | |
return false; | |
} | |
function loop(arr, findMe) { | |
for(let item of arr) { | |
if (item === findMe) { | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment