Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. var palindrome = function(phrase) {
  2. var initialPhrase = phrase;
  3. var copyPhrase = phrase.split("").reverse().join(""); // copies the string chars into an array
  4. console.log("initial phrase", initialPhrase); // eg. "Hello World!"
  5. console.log("copy phrase", copyPhrase); // eg. "!dlroW olleH"
  6.  
  7. return initialPhrase === copyPhrase;
  8. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement