How do I reverse the words in this string including the punctuation?
String.prototype.reverse = function () { return this.split(\'\').reverse().join(\'\');
Simply reversing the string wont give the solution.
var str = "This is fun, hopefully."; alert(str.split("").reverse().join("").split(" ").reverse().join(" "));