Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Find a palindrome using Array methods

let str = "civic";
let strReverse = str.split("").reverse().join("");

if (str === strReverse) {
  console.log("The string is a palindrome");
} else {
  console.log("NOT a palindrome");
}
Source by sebhastian.com #
 
PREVIOUS NEXT
Tagged: #Find #palindrome #Array #methods
ADD COMMENT
Topic
Name
1+5 =