SHARE
TWEET

Untitled

a guest Jan 19th, 2020 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function likes(names) {
  2.   // TODO
  3.   if (names.length === 0) {
  4.     return "no one likes this"
  5.   }
  6.   if (names.length === 1) {
  7.     return names[0]+" likes this"
  8.   }
  9.   if (names.length === 2) {
  10.     return names[0]+" and "+names[1]+" like this"
  11.   }
  12.   if (names.length === 3) {
  13.     return names[0]+", "+names[1]+" and "+names[2]+" like this"
  14.   }
  15.   return names[0]+", "+names[1]+" and "+(names.length - 2) +" others like this"
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top