Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var palindrome = function(phrase) {
- var initialPhrase = phrase;
- var copyPhrase = phrase.split("").reverse().join(""); // copies the string chars into an array
- console.log("initial phrase", initialPhrase); // eg. "Hello World!"
- console.log("copy phrase", copyPhrase); // eg. "!dlroW olleH"
- return initialPhrase === copyPhrase;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement