Who likes it?

From codewars.com by Edxael  (that’s me)

You probably know the “like” system from Facebook and other pages. People can “like” blog posts, pictures or other items. We want to create the text that should be displayed next to such an item.

Implement a function likes :: [String] -> String, which must take in input array, containing the names of people who like an item. It must return the display text as shown in the examples:

 

For more than 4 names, the number in and 2 others simply increases.

— My Code —

Note:  The following code is not written by me, it was created by another user of codewars.com it belongs to the user: “surendraa” enjoy.

 



Copyright 2017. All rights reserved.

Posted December 31, 2016 by Edmundo in category "Ruby Examples