javascript - "var variable" returns undefined? -
when run "var variable = true;" in chrome console "undefined" returned:
> var variable = true; undefined
but when run without "var" returns true:
> variable = true; true
why returning "undefined" "var"?
it's confusing cause expected return true.
the first statement, while second expression. while not quite same, similar c's rules:
// statement has no value. int x = 5; // expression... x = 10; // ...that can passed around. printf("%d\n", x = 15);
Comments
Post a Comment