Answer the question
In order to leave comments, you need to log in
Why is a number displayed and not undefined?
Hello!
Explain plz.
function num(i) {
var i = i;
console.log(i);
}
num(3);
Answer the question
In order to leave comments, you need to log in
Maybe this post will shed some light on the situation.
for each variable (var)
- a VO property is created with the name of the variable, and the value is undefined; if a property with the same name already existed in the VO, it remains untouched.
So where does undefined come from?
After all, your code is fundamentally no different from this:
var foo = i;
console.log(foo);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question