hahahe
June 23, 2020, 7:57am
1
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”));
hahahe
June 23, 2020, 7:58am
2
Basic Algorithm Scripting: Confirm the Ending
hahahe:
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”));
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: https://stackoverflow.com/questions/12719859/no-visible-cause-for-unexpected-token-illegal