Update 07_day_functions.md (Line 238 and 250)

Unlimited number of parameters, needs to add ". . . arguments" inside the square bracket.
pull/380/head
Xavier Render 3 years ago committed by GitHub
parent 646c7781ae
commit f7bc67c256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -235,7 +235,7 @@ Sometimes we do not know how many arguments the user going to pass. Therefore, w
```js ```js
// Let us access the arguments object // Let us access the arguments object
function sumAllNums() { function sumAllNums(...arguments) {
console.log(arguments) console.log(arguments)
} }
@ -247,7 +247,7 @@ sumAllNums(1, 2, 3, 4)
```js ```js
// function declaration // function declaration
function sumAllNums() { function sumAllNums(...arguments) {
let sum = 0 let sum = 0
for (let i = 0; i < arguments.length; i++) { for (let i = 0; i < arguments.length; i++) {
sum += arguments[i] sum += arguments[i]

Loading…
Cancel
Save