Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Addition aruments in javascript

function addNumbers(num1, num2) {
    let sum = 0;
    for (const num of arguments) {
        sum = sum + num;
    }
    return sum;
}
const sum = addNumbers(1, 2, 3, 4, 5)
console.log(sum);
//Output: 15
 
PREVIOUS NEXT
Tagged: #Addition #aruments #javascript
ADD COMMENT
Topic
Name
8+6 =