Day 5 is Reverse string. The classic problem to reverse string.
For instance string 'Hello' reversed into 'olleH'.
Since a string can be split
into array, we can reverse the arrangement of array with reverse
and concat the array with join
to reverse it back into single string.
There is JavaScript solution
function reverseAString(str) {
return str.split('').reverse().join('');
}
Top comments (0)