Why cant this work?

function confirmEnding(x, y) {

var k=0;

for(var i=0;i<y.length;i++){

if(x.split('').reverse()[i]=y.split('').reverse()[i]){

  k++;

}



}

if(k=y.length){

return true;

}

else{

return false;

}

}

console.log(confirmEnding(“Bastian”, “pen”));

Basic Algorithm Scripting: Confirm the Ending

So your code gets parsed by JS interpreter where it gets broken into pieces called tokens. There are 4 of them when it fails to do that it will give out an error and your code wont work

more info here: javascript - No visible cause for "Unexpected token ILLEGAL" - Stack Overflow