Skip to content

Instantly share code, notes, and snippets.

@D3press3dd
Last active August 6, 2022 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save D3press3dd/429b6155bd7a0fbb00c61ad80afa0703 to your computer and use it in GitHub Desktop.
Save D3press3dd/429b6155bd7a0fbb00c61ad80afa0703 to your computer and use it in GitHub Desktop.
Make a program that filters a list of strings and returns a list with only your friends name in it. If a name has exactly 4 letters in it, you can be sure that it has to be a friend of yours! Otherwise, you can be sure he's not... Ex: Input = ["Ryan", "Kieran", "Jason", "Yous"], Output = ["Ryan", "Yous"] i.e. frien
7 kyu kata answer to 'Friend or Foe?
function friend(friends){
return friends.filter(singleFriend=>singleFriend.length===4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment