javascript split reverse code example
Example 1: javascript .split().reverse.join
"this is a test string".split("").reverse().join("");
//"gnirts tset a si siht"
//as a function
function reverseString(string){
return string.split("").reverse().join("");}
reverseString("test string");
//"gnirts tset"
Example 2: javscript .split().reverse.joni
"this is a test string".split("").reverse().join("");
Example 3: reverse string js
str.split('').reduce((reversed, character) =>{
return character + reversed;
}, '');
//apple = leppa