change three argument in js code example
Example 1: arguments object in javascript
var sum = 0;
function addAll(){
for (var i = 0; i<arguments.length; i++){
sum+=arguments[i];
}
console.log(sum);
}
addAll(1, 2, 3, 4, 5, 6, 7, 8, 9,10);
Example 2: are parameters modified in javascript
function square(x) {
x = x * x;
return x;
}
var y = 10;
var result = square(y);
console.log(y);
console.log(result);
function turnOn(machine) {
machine.isOn = true;
}
var computer = {
isOn: false
};
turnOn(computer);
console.log(computer.isOn);