Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js array find

const myArray = ["sun","moon","earth"];
const lookingFor = "earth"

console.log(myArray.find(planet => { return planet === lookingFor })
// expected output: earth
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #array #find
ADD COMMENT
Topic
Name
6+1 =