var str = "helloolleh";
var answer = true;
for(var i = 0, j = str.length - 1; i<j; i++, j--){
if(str[i] != str[j]) {
answer = false;
break;
}
};
if(answer == false){
console.log("This string isnt pallendrom");
}
else console.log("String is pallendrom");
Comments
Leave a comment