constlikeText=(likes=[])=>{if(!likes.length)return'no one likes this';const[first,second,third,...rest]=likesif(!second)return`${first} likes this`;if(!third)return`${first} and ${second} like this`;if(!rest.length)return`${first}, ${second} and ${third} like this`;return`${first}, ${second} and ${rest.length+1} others like this`;}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Using destructuring with JS