SHARE
TWEET

Untitled

a guest Jan 19th, 2020 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function likes(names) {
  3.  if(names.length === 0) {
  4.    return 'no one likes this'
  5.  } else if( names.length === 1) {
  6.    return `${names[0]} likes this`;
  7.  } else if (names.length === 2) {
  8.    return `${names[0]} and ${names[1]} like this`;
  9.  } else if (names.length === 3) {
  10.    return `${names[0]}, ${names[1]} and ${names[2]} like this`;
  11.  } else if (names.length >= 4) {
  12.    return `${names[0]}, ${names[1]} and ${names.length - 2} others like this `;
  13.  }
  14. }
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