Two dimensional array as parameter

i have a problem that i am not yet able to solve that is asked for me to create a function.

the exercise goes like this:
Write a function named getValidPassword that takes a two dimensional array as parameter.

Each entry in the array represents a passcode. You need to find the passcode that has no odd digits and return it from your function.

Here’s an example:

var loggedPasscodes =[
    [1, 4, 4, 1],
    [1, 2, 3, 1],
    [2, 6, 0, 8],
    [5, 5, 5, 5],
    [4, 3, 4, 3, 8],
    [4, 3, 2, 3, 9]
];

getValidPassword(loggedPasscodes) // returns the array: [2, 6, 0, 8]

my code is:

function getValidPassword (loggedPasscodes){
  for(let i= 0; loggedPasscodes.length > i;i++){
      let passcode = loggedPasscodes [i];
      for (let j = 0;passcode.length > j; j++){
          if(passcode [j] % 2 !== 0){
              break;
          }
          
      }

        return passcode;
  }     
   
}                  
                                
                                
                                
 var loggedPasscodes=[
    ["1","4","4","1"],
    ["1", "2", "3", "1"],
    ["2","6", "0","8"],
    ["5", "5", "5", "5"],
    ["4","3", "4", "3"],
];
console.log(getValidPassword(loggedPasscodes));

and i get the error:

Code is incorrect
Function getValidPassword is not working as requested.
[

“1”,

“4”,

“4”,

“1”

]

can someone help?

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

thank you very much and sorry about that

can you descrive in your own words what your function is doing?

what do you think this if statement will do when the first number it sees is odd?
And what is the next line of code that will be executed in this case?

Currently, your code is checking to see if passcode (an array) contains an odd number as a element and then you break if it does. When you break, the for loop exits. Next, you return passcode. Do you really want to exit the for loop when you find an odd number and then return the passcode?