Build a First Element Finder - Build a First Element Finder

Tell us what’s happening:

i am stuck cant pass num. 4 please help me see why

Your code so far

function findElement(arr,func){

for(let i=0;i < arr.length;i++){

if(arr[i] % 2 === 0){
return arr[i]

}else if(arr[i].length > 5){
return arr[i]


}
}
}


console.log(findElement(["hello", "world", "javascript"], function(str) { return str.length > 5; }))
console.log(findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }))
console.log(findElement([1, 2, 3, 4], function(num) { return num > 2; }))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36

Challenge Information:

Build a First Element Finder - Build a First Element Finder
https://www.freecodecamp.org/learn/full-stack-developer/lab-first-element-finder/build-a-first-element-finder

why are you writing this?

you should not hard code

you have func, use that

ohh ok sorry i didnt understad what to do

if there is any questions you have, or doubts to clear, please ask, and we will help

i have a general question i dont know if i’m permitted to ask?

the only way to find out is to ask the question, so please ask

the questions in javascript have little or no guide to follow its really difficult for a beginner to figure out

are we supposed to get help from external source?

what questions are you having difficulties with?

you can always come to the forum to ask for help like you just did

the forum is really strict on not revealing answers if u know what i mean

i dont have a specific question thats difficult its just the questions are really clewless and its soo fraustrating when am stuck and all that started in javascript

you should come to the forum to ask for help, not search for answers to copy, people will help you

do you have feedback on specific lessons? that would help improving them

it is hard to start a programming language if you have never programmed before, it also requires to practice problem solving a lot

1 Like

yes i just started DOM manipulation and am lost i’ll need some extra exercise to catch up

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.