Skip to content

Instantly share code, notes, and snippets.

@emmabostian
Created June 23, 2021 08:20
Show Gist options
  • Save emmabostian/660f5d49591e7008066e86aac041a2fc to your computer and use it in GitHub Desktop.
Save emmabostian/660f5d49591e7008066e86aac041a2fc to your computer and use it in GitHub Desktop.
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