정수/부동소숫점을 통째로 Number 데이터 타입으로 처리한 점이 다른 문법과 다르다.
**typeof (**변수의 데이터 타입을 확인하기 위한 문법)
typeof 후 한칸 띄고 변수명을 써야 한다.
const testValue = 1;
console.log(typeof testValue);
const testValue2 = 'test';
console.log(typeof testValue2);
true 와 false 두 값을 가질 수 있음
참고
파이썬은 True 와 False 인데 반해서, javascript 는 소문자 true 와 false 이다.
let test = 1 > 2;
console.log(test);
console.log(typeof test);
Boolean() 로도 true 또는 false 의 Boolean 타입의 값을 가져올 수도 있다.
문자열의 경우는 문자열이 없는 경우는 false, 있기만 하면 true이다.
let testBoolean1 = Boolean('hi');
console.log(testBoolean1);
let testBoolean2 = Boolean('');
console.log(testBoolean2);
null은 값이 없음을 나타내고, undefined 는 값이 할당되지 않았음을 나타낸다.
null 은 null 이라는 이름의 값, 하나만 가질 수 있다.
undefined 도 undefined 이라는 이름의 값, 하나만 가질 수 있다.
let testUndefined; // 값을 할당하지 않았을 때(초기화하지 않았을 때)
console.log(typeof testUndefined1, testUndefined1);
let testNull1 = null;
console.log(typeof testNull1, testNull1); // null 의 값은 null 이지만, null 의 데이터 타입은
object 로 출력됨을 확인해주세요