I want to build a function to know how many prime numbers there are in my matrix (5) and I want to return the quantity - 5
Can anyone understand where my mistakes are? At the end there is a mistake for sure, because I was unable to return the quantity
let matrix = [ [50,17], [19,20,6,40,14], [97] ,[31,9,5] ];
let counter = 0
for(let row = 0 ; row < matrix.length ; row++){
for(let col = 0 ; col < matrix[row].length ;col++){
function matrixPrimeNumbers(num){
for(let d = 2 ; d<= num -1 ; d++) {
if(num % d == 0){
return false;
}
num++;
return num.charAt();
}
}
}
}