Add method to String to Append separator to String - Node.js String

Node.js examples for String:String End

Description

Add method to String to Append separator to String

Demo Code

String.prototype.append = function(_separator, _stringToAppend) {
  if (this.length == 0) {
    this.value = _stringToAppend;//ww  w.  j av  a2s . co m
  } 
  else {
    this.value += _separator + _stringToAppend;
  }
}

Related Tutorials