Here is the code:
var num = 3
myFunction(num)
function myFunction(aNumber)
{
aNumber = 20
}
console.log(num)
it still says that 'num' is 3 and I was wondering why?
Here is the code:
var num = 3
myFunction(num)
function myFunction(aNumber)
{
aNumber = 20
}
console.log(num)
it still says that 'num' is 3 and I was wondering why?
You dont have to pass global variables into functions to reassign them.
function myFunction() {
num = 20
}
console.log(num);