Instead of individually passing through the argument how can I loop through an array and check to see if each word is a palindrome? If it is I want to return the word if not i want to return a 0.
var myArray = ['viicc', 'cecarar', 'honda'];
function palindromize(words) {
var p = words.split("").reverse().join("");
if(p === words){
return(words);
} else {
return("0");
}
}
palindromize("viicc");
palindromize("cecarar");
palindromize("honda");