Generation

generate functionFri, 18 Nov 2022

add 3 numbers

function add(a,b,c){ return a + b + c; } add(1,2,3) // use the rest operator function add(...nums){ let total = 0; for (let num of nums){ total += num; } return total; } add(1,2,3,4,5,6)

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant