TypeError: Cannot read property 'length' of undefined
The function's argument was friends and your wrote friend.length that's why you get that error. There are other problems with that code, but because you already have a working solution, I'm not going to explain them.
Please read this: https://docs.codewars.com/training/troubleshooting#post-discourse
About the error it shows, read it:
The function's argument was
friends
and your wrotefriend.length
that's why you get that error. There are other problems with that code, but because you already have a working solution, I'm not going to explain them.This comment is hidden because it contains spoiler information about the solution