DEV Community

Discussion on: From "hello world" to "world hello": Reversing the Words in a String

Collapse
 
mamadontallow profile image
MamaDontAllow

var string = "happy birthday to you";
string = string.split(" ").reverse().join(" ");
console.log(" string : " + string)