how to assign an rest operator in javascript
function multiply(multiplier, ...theArgs) {
return theArgs.map(element => {
return multiplier * element
})
}
let arr = multiply(2, 1, 2, 3)
console.log(arr) // [2, 4, 6]
function addition(...nombre) {
let resultat = 0
nombre.forEach(nombre => {
resultat+= nombre ;
});
console.log(resultat) ;
}
addition(4 ,9 ,5 ,415 ,78 , 54) ;
Also in JavaScript:
- compare two arrays javascript
- ajax response length
- jquery onchange input value
- getusermedia example
- how to change package name in react native
- material ui grid react
- some in javascript
- javascript onsubmit form validation
- jquery filter array remove empty values
- jquery add hidden attribute
- javascript alert program
- string to JSONobject + android
- replace white spaces javascript
- using a variable in regex javascript with boundary marker
- react enzyme simulate change
- javascript object total
- 3 dots to get all object properties in JS
- passport how to replace missing credential
- react router command
- chrome add bookmark that prefixes text
- include jquery
- how to set background colour i js inline stylel
- difference between var let and const in javascript with example
- js object destructuring with defaults