-
-
Save thefonso/8c962c858b3cf74e08ca2250d65b6000 to your computer and use it in GitHub Desktop.
Given an unsorted array of n elements, find if the element k is present in the given array or not. return 'YES' or 'NO'
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 findNumber(arr, k) { | |
let result = 'NO'; | |
arr.forEach(item => { | |
if(k === item) { | |
return result = 'YES'; | |
} | |
}) | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment