Returns the array as a string with tuple notation, e.g: [1,2,3] -> (1,2,3) - Node.js Array

Node.js examples for Array:Swap

Description

Returns the array as a string with tuple notation, e.g: [1,2,3] -> (1,2,3)

Demo Code

Array.prototype.tuple = function () {
    var result = "(" + this[0];
    for (var i = 1; i < this.length; i++)
        result += "," + this[i];
    result += ")";
    return result;
};

Related Tutorials