Study/Coding

Scope and Hoisting

Haayany 2020. 3. 1. 11:35

Global scope

All functions can access items

it's a good idea to make a Global variable with objects

 

Function Scope

Resolves names by looking at function, then surrounding functions, then the global scope

 

var and Hoisting

Use let and const to declare

JavaScript only hoists declarations, not initializations.

 

Undeclared Variables and Strict Mode

You can use strict mode by putting 'use strict'; on top of the code

'Study > Coding' 카테고리의 다른 글

DOM objects/elements  (0) 2020.05.22
Array  (0) 2020.03.01
Objects  (0) 2020.02.17
Functions  (0) 2020.02.12
Program Flow  (0) 2020.02.12