Tell us what’s happening:
Help me with this codewars problem ;_; I keep getting the following
Your code so far
let array1 = [‘Alex’, ‘Jacob’, ‘Mark’, ‘Max’]
function likes (names) {
if (names===0)
{
return(“noone likes this”);
}
if (names===1)
{
return(names[0]+", like this");
}
if (names===2)
{
return(names[0]+" and “+names[1]+” like this");
}
if (names===3)
{
return(name[0]+", “+names[1]+”, and “+names[2]+” like this");
}
if (names > 3)
{
return (names[0]+", “+names[1]+”, “+ names[2]+” and “+ names.length-3+ " others like this”);
}
}
console.log(array1);
console.log(likes(array1));
// Your code above this line
Link to the challenge: