0 votes
48 views
asked in java script by (4k points)
Hi All

    Hidden Features of JAVA Script?

1 Answer

0 votes
answered by (2.3k points)

You don't need to define any parameters for a function. You can just use the function's arguments array-like object.

function sum() {
    var retval = 0;
    for (var i = 0, len = arguments.length; i < len; ++i) {
        retval += arguments[i];
    }
    return retval;
}

sum(1, 2, 3)

Categories

...