Doing string reverse is a common thing in every other programming language.
But here we are going to learn about how efficient and how easy we can do JavaScript String Reversal
.
Let’s say to understand this, will take Palindrome
challenge where string reversal mainly considered.
Mahamaham
is the Palindrome string, even if we reverse it will finally get the output as Palindrome
.
const val = 'Mahamaham';
const inputs = val.split('');
const reversedVal = inputs.reverse().join('');
console.log(val === reversedVal); // true
Reverse
api is life saver from ES6
JavaScript.
Even you can take a look at our previous blog where listed down the new additions ofES2020
JavaScript.