Sachin Kadam Sachin Kadam - 1 year ago 98
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