종우의 컴퓨터 공간

데이터 타입(data types) 본문

자바 스크립트 (JavaScript)/JavaScript Language Fundamentals

데이터 타입(data types)

종우공간 2021. 7. 23. 13:03

Primitive Data Type

- stroed directly in the location the variable accesses

- stored on the stack

- String, Number, Boolean, Null, Undefined, Symbols(ES6)

 

Reference Data Type

- accessed by reference

- objects that are stored on the heap

- a pointer to a location in memory

- Arrays, Object Literals, Functions, Dates, Anything Else...

 

Dynamically Typed Language

- Types are associated with values not variables

- The same variable can hold multiple types

- We do not need to specify types

- Most other languages are statically typed (Java, C#, C++)

- There are supersets of JS and addons to allow static typing(TypeScript, Flow)

 

'typeof' 연산자

- typeof 연산자는 피연산자의 평가 전 자료형을 나타내는 문자열을 반환한다.

- primitive data type 중에 Null은 자료형이 Object로 나오는데, 일종의 버그라고 생각하면 된다.