Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isPalindrome(str) {
- return [...str].reduce((previous, next) => next + previous) === str
- ? `${str}: is a Palindrome :)`
- : `${str}: is not a Palindrome :(`;
- }
- console.log(isPalindrome("nope this isn't")); // false
- console.log(isPalindrome("mom")); // true
- console.log(isPalindrome("gohangasalamiimalasagnahog")); // true, I think
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement