Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. function isPalindrome(str) {
  2. return [...str].reduce((previous, next) => next + previous) === str
  3. ? `${str}: is a Palindrome :)`
  4. : `${str}: is not a Palindrome :(`;
  5. }
  6.  
  7. console.log(isPalindrome("nope this isn't")); // false
  8. console.log(isPalindrome("mom")); // true
  9. console.log(isPalindrome("gohangasalamiimalasagnahog")); // true, I think
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement