 # function addNumber (num1, num2){ consle.log(arggrement); const result = num1 num2; return result; } const sum = addNumber(23,13 50, ); console.log(sum)

```function addNumber (num1, num2){
consle.log(arggrement);
const result = num1 + num2;

return result;
}
const sum = addNumber(23,13 50, );
console.log(sum)```

Here is what the above code is Doing:
1. We are creating a function called addNumber.
2. We are passing two parameters, num1 and num2.
3. We are creating a variable called result and assigning it the value of num1 + num2.
4. We are returning the value of result.
5. We are creating a variable called sum and assigning it the value of the function addNumber.
6. We are passing the arguments 23 and 13 to the function addNumber.
7. We are logging the value of sum to the console.

The output of the above code will be 36.

Now, let’s look at the code again:

const sum = addNumber(23,13 50, );

We are passing three arguments to the function addNumber, but we only have two parameters.

What happens to the third argument?

The third argument is stored in an array called arguments.

We can access the third argument by using arguments.

Let’s log the third argument to the console:

consle.log(arggrement);
const result = num1 + num2;

return result;
}
const sum = addNumber(23,13 50, );
console.log(sum)

The output of the above code will be 50.

We can also access the third argument by using the rest operator.

The rest operator is three dots (…) followed by the name of the parameter.

Let’s use the rest operator to access the third argument:

consle.log(rest);
const result = num1 + num2;

return result;
}
const sum = addNumber(23,13 50, );
console.log(sum)

The output of the above code will be 50.

The rest operator is useful when we don’t know how many arguments will be passed to the function.

Let’s look at another example: