Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Rest Operator in javascript

function restOp(firstNum, ...args) {
    let result = [];
    for (let i in args) {
        const multi = firstNum * args[i];
        result.push(multi)
    }
    return result;
}
console.log(restOp(3, 2, 3, 5));
//Output:[ 6, 9, 15 ]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #Rest #Operator #javascript
ADD COMMENT
Topic
Name
9+8 =