Values, Variables, and Literals

  • Revision slug: Talk:JavaScript/Guide/Values,_variables,_and_literals
  • Revision title: Values, Variables, and Literals
  • Revision id: 86394
  • Created:
  • Creator: Matías Mirabelli
  • Is current revision? No
  • Comment page created, 95 words added

Revision Content

I guess that the concept about what the var keyword does is quite wrong. There say that var "declares" a variable, and conceptually this keyword just binds a variable to the current scope. var is designed for scope bounding, not for declaring variables. Indeed, all variables in JavaScript are implicit and they're placed in the global scope by default, that's because it's so important to use var to bound a variable to a scope (even if we want to bound a variable to the global scope).

Could it be reviewed?

Thanks,

Matías

Revision Source

<p>I guess that the concept about what the <em>var</em> keyword does is quite wrong. There say that var "declares" a variable, and conceptually this keyword just binds a variable to the current scope. var is designed for scope bounding, not for declaring variables. Indeed, all variables in JavaScript are implicit and they're placed in the global scope by default, that's because it's so important to use var to bound a variable to a scope (even if we want to bound a variable to the global scope).</p>
<p>Could it be reviewed?</p>
<p>Thanks,</p>
<p>Matías</p>
Revert to this revision