Must-Know JavaScript One-Liners for Developers: Part 1
Reverse a string
The split function helps us break a string into multiple individual elements, which can then be reversed and joined to a full string.
function isPalindrome(str) {
return str === str.split('').reverse().join('');
}
// Example...
blog.varunjoshi.co.in1 min read