Open
Description
var age = 7;
function addOne (x) {
x = x +1;
}
addOne(age);
document.write(age);
I'm gonna break this down the way I have understood.
So, we have a function called addOne which adds 1 to the value it accepts, right?
And then we call the function with an argument of the value 7. So, now the function adds 1 to 7 and age is 8.
But why is it that when I print out the value of age, it prints out 7 ??
Metadata
Metadata
Assignees
Labels
No labels