Sachin Kadam Sachin Kadam - 2 years ago 106
Javascript Question

Inline input to custom function

I like to implement reverse() method on string.
But input should be inline. such as,


function reverse(){
return reverse("").join(" ");

Answer Source

Try this ?

String.prototype.reverse = function() {
  return this.split("").reverse().join("");

"test".reverse() // tset

Don't forget to define the propotype before use it

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download