Here's my code:
function friend(friends){
let here =[];
for (let i = 0; i < friends.length; i ) {
if (friends[i].length == 4){
here.push(friends[i]);
}
}
console.log(here);
}
friend([ 'Ace', 'Luffy', 'Zoro', 'Nami', 'Ussop' ]);
When I test my program it says:
expected undefined to deeply equal [ 'Ryan', 'Mark' ]
CodePudding user response:
Your function should return the result, not print it out to the console. I.e., replace console.log(here)
with return here
.