let str = "test"
// new: 새로운 객체를 만들겠다
let str2 = new String("test")
console.log(typeof(str)) // string
console.log(typeof(str2)) // object
console.log(str) // test
console.log(str2) // 사진 참고
console.log(str2.toUpperCase()) // TEST, 객체니까 함수가능
근데....
console.log("test".toUpperCase()) // TEST
얘도 돌아감... 객체가 아닌데... 이게 왜 댐?
→ JS는 내부적으로 원시타입에 대해 내장 객체를 갖고 있음
원시 타입 사용시에 내작 객체로 알아서 해석...
JS가 개같은 이유
3. null: 변수에 값이 없음을 의도적으로 표현할 때 사용
4. undefined:변수 선언 이후 직접 값을 할당하지 않으면자동으로 할당됨
let a = null // null
let b // undefined
5. Boolean(True / False): 조건문 또는 반복문에서 Boolean이 아닌 애들은 자동형변환 됨
댓글