형변환
문자 -> 숫자 string to number
number()
parseInt()
perseFloat()
숫자 -> 문자 number to string
123.toString()
(12.3).toString()
문자 -> 불리언 string to boolean
Boolean("true")
불리언 -> 문자 boolean to string
String(true)
숫자 -> 불리언 number to boolean
Boolean(1) => true로 반환
Boolean(0) => false로 반환
불리언 -> 숫자 boolean to number
Number(true) => 1로반환
Number(false) => 0으로 반환
'JS > JS 공부' 카테고리의 다른 글
[JS] 반복문 while, for (0) | 2023.04.14 |
---|---|
[JS] Math & Random 수학관련 함수 (0) | 2023.04.14 |
[JS] 조건문 if, switch / 널병합 연산자 ?? (0) | 2023.04.14 |
[JS] Date 날짜 관련 함수 (0) | 2023.04.13 |
[JS] stringMethod 문자 메서드 (0) | 2023.04.13 |