최신ECMAScript 표준은 7개의 자료형으로 정의
1.기본 자료형(6가지 데이터 타입)
이중에서 symbol 과 object 제외 하고 설명할 예정이다.
boolean
불린은 컴퓨터과학에서 논리적인 데이터 유형이다. 불린은
참 혹은 거짓 값을 가진다.
JS에서 불린조건은 어떤 코드부문이 실행되어야지 할지 어떤 코드 부문을 반복해야할지 결정하는데 쓰인다.
아래는 불린이 쓰일수 있는 예시를 보여주는 유사코드
***JavaScript if Statement***
if(boolean conditional) {
//coding
}
if(true) {
console.log("boolean conditional resolved to true");
} else {
console.log("boolean conditional resolved to false");
}
***JavaScript for Loop***
for(control variable; boolean conditional; counter) {
//coding
}
for(var i=0; i<4; i++) {
console.log("I print only when the boolean conditional is true");
}
NUll
NUll 값은 일반적으로 존재하지 않거나 유효하지 않는 objedt또는 주소를 의도적으로 가리키는 참조이고
null = 0;
에서 0은 숫자 0이 담겨 있음.
undefined
원시값으로, 선언 후 값을 할당하지 않는 변수 혹은 값이 주어지지 않은 않은 인수에 자동으로 할당된다.
ar x; // 값을 할당하지 않고 변수 선언
console.log("x's value is", x) // "x's value is undefined" 출력
Number
JS에서 number는 수치 데이터 타입
String
특정한 컴퓨터 프로그래밍 언어에서 문자를 표현하는 데 사용되는 문자열 시퀀스이다.