Reverse a string

var str = "Hellow World is done";
console.log(str);
var str2 = str.split('').reverse().join('');
console.log(str2);

[vc_single_image image=”918″ img_size=”full”]

Reverse a string but don’t change the position of the word.

var str3 = str.split('').reverse().join('').split(' ').reverse().join(' ');
console.log(str3);

Leave a Reply

Your email address will not be published. Required fields are marked *