Basic Algorithm Scripting - Finders Keepers

Tell us what’s happening:
Describe your issue in detail here.
has this code syntax been taught and where has it been taught

Your code so far

function findElement(arr, func) {
  let num = 0;
  return num;
}

findElement([1, 2, 3, 4], num => num % 2 === 0);

Your browser information:

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

Challenge: Basic Algorithm Scripting - Finders Keepers

Link to the challenge:

Many previous challenges have talked about callback functions, especially in the ES6 section.

1 Like

cannot find the part that refers to it

didnt know if the prev message pinged so i am sending a reply

You may be rushing too quickly through the material.

Look at the Challenges discussing map and filter.

2 Likes

still cannot find the code syntax
the use of func() in

function findElement(arr, func) {
  for (let i = 0; i < arr.length; i++) {
    if (func(arr[i])) {
      return arr[i];
    }
  }
  return undefined;
}

also i don’t know where the split keyword, touppercase and tolowercase was taught

You don’t need those for this exercise

This is correct usage.


These challenges are not about finding the right ‘magic syntax’. Its about using whatever syntax you want to solve the described problem.

2 Likes

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