Skip to content

Instantly share code, notes, and snippets.

@healim
Last active July 18, 2018 08:28
Show Gist options
  • Save healim/dc1c9e0d6deca7c64ad5a4e53869f8bb to your computer and use it in GitHub Desktop.
Save healim/dc1c9e0d6deca7c64ad5a4e53869f8bb to your computer and use it in GitHub Desktop.
QQ. javascript 변수, 메모리에서 어떻게 관리하는지
var variableTest = "hi"
variableTest = "hello"
var variableTest = "Good Morning"

const constTest = "hi"
// constTest = "hello"
// const constTest = "Good Morning" 
// 구문 오류 : Identifier 'constTest' has already been declared

let letTest = "hi"
letTest = "hello"
// let letTest = "Good Morning"
// 구문 오류 : Identifier 'letTest' has already been declared

console.log(variableTest, constTest, letTest)

테스트해보다 궁금한 점 생김

  • function scope(var)와 block scope(let, const) 뭐가 다르지?
  • let 재선언시 에러 나는 이유, var은 안 나는 이유
  • let에 재할당 가능한 이유, const는 재할당 불가능한 이유

=> 변수, 상수인거 말고 이 값들 어떻게 관리하길래 이렇게 되는지 +) primitive, 값 전달, 참조 전달 -> 변수 관련해서 설명할 수 있어야 하는 개념 +) 형변환 (Type Casting)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment