In our previous blog we understood,
Javascript DSA — 01 : String Reversal
Today we will se second DSA Problem,
“Given a string, check if we reversed will the string is same as original string”
On to the solution!!!
Solution 01: our array solution,
In this example, we are converting string into Array. We just reversed the array and again converted into string using join(‘’) and stored in new variable.
Solution 02: Complex Approach
So now in our second solution, we are taking character and checking whether the character is same from last.