JavaScript by Patrik

Var in JavaScript

The var declares a variable with function scope.

Scope of var

  • Global scope normally
  • Start to end of the function inside of the function

Redeclaration

  • Yes, can redeclare it in the same scope

Hoisting

  • Hosted at the top of the global scope
  • It can be used before the declaration

Comments

Leave a Comment

All fields are required. Your email address will not be published.