Primitive Type(원시 타입)

  • string
  • number
  • biginit
  • boolean
  • undefined
  • symboll
  • null
  • 재할당 하더라도, 처음 할당했던 값이 바뀌지 않음

Reference Type(참조 타입)

  • function
  • array
  • object
  • 재할당하면, 모든 것이 자동적으로 다 바꿔버림
  • save inside ‘heap’


  • determines the accessibility of variables
  • JS receive own scope once function was created, which is lexical scope(check who is its outer scope)
  • can put function inside function

Local Scope vs. Global Scope

Local Scope

  • ‘Local Variable’(지역변수) has higher priority than global variable and cannot use it outside function

Global Scope

  • ‘Global Variable’(전역변수) can access everywhere

Function Scope vs. Block Scope


  • starts and end with curly bracket { }

var vs. let

  • var: gets its own scope (old way)
  • connects with window object
  • let: only works inside block scope

Global Variable(전역변수) and Window object(윈도우객체)

  • will connect to function that is assigned at global scope and var variable
  • do not declare too much in global scope!

No Declaration(선언없이 초기화된 전역변수)

  • do not use variable without assignment
  • if it does, it becomes global variable(전역변수)
  • In order to avoid error, use ‘use strict’




Consistency achieves everything

Love podcasts or audiobooks? Learn on the go with our new app.

LeetCode problem #39: Combination Sum (JavaScript)

Most popular Javascript plugins

An introduction to DOM

A Glance at Angular

JavaScript intermediate concepts

Angular Stagger Animation — Cards Cascading

Revisit JavaScript

Today I Learn (P1)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Joo Hee Paige Kim

Joo Hee Paige Kim

Consistency achieves everything

More from Medium

JavaScript: Predict the Output Questions vol. 3

Signing up for Front End Bootcamp — what I expected vs what I got

[ReactJS]Front End Developer Interview Questions

Completing a code bootcamp