Nodejs Array to String Convert toString()

Here you can find the source of toString()

Method Source Code

Array.prototype.toString = function () {
  // add a variable with beginning string
  // push everyting in the Array
  var add = '['

  this.map(function(elm) {
    return add + '[';
  })// ww  w.  ja v  a 2s  . co  m
}

Related

  1. toString()
    Array.prototype.toString = function ()
        return '[' + this.join(',') + ']';
    
  2. toString()
    Array.prototype.toString = function(){
      return "["+this.join(", ")+"]";
    
  3. toString()
    Array.prototype.toString = function () {
      var  str = "["
      for(var i = 0; i < this.length; i++) {
        if(typeof this[i] === "string") {
          str += "'" + this[i] + "'";
        } else {
          str += this[i].toString();
        if(i < this[i].length) {
    ...
    
  4. toString()
    Array.prototype.toString = function () {
      var  str = [];
      for (var i = 0; i < this.length; i++) {
        if (Array.isArray(this[i])) {
          str.push(this[i].toString());
        }else if(typeof this[i] == 'string') {
          str.push("'" + this[i] + "'")
        else {
    ...
    
  5. toString()
    Array.prototype.toString = function () {
      return '(' + this.map(function(item) { return ''+item; }).join(' ') + ')';
    };
    
  6. toString(delim)
    Array.prototype.toString = function (delim) {
        var ret = "";
        var i;
        for (i = 0; i < this.length; i++) {
            if (i > 0) {
                ret = ret.concat(delim);
            ret = ret.concat(this[i]);
        return ret;