/..

Dark Mode

Enable Console

The Function

friend([])
friend(friends)

/*
  Returns a list of (friend's) names that are filtered
  by length - in this case it's the length of four.
*/

friend(["Ryan", "Kieran", "Mark"]); 
// ["Ryan", "Mark"]

friend(["John", "Alex", "Robert", "Fred"]); 
// ["John", "Alex", "Fred"]

Solution by - Need4Swede

How it works

function friend(friends) {

  // Return names that are four characters in length
  return friends.filter(fname => fname.length === 4)

}

Try it yourself - Codewars Source

You can also use my built-in JavaScript console