형변환
문자 -> 숫자 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으로 반환
'HTML.CSS.JS > JS' 카테고리의 다른 글
[JS] 제곱 구하기 (while문 이용) (0) | 2023.04.14 |
---|---|
[JS] Math & Random 수학관련 함수 (0) | 2023.04.14 |
[JS] 조건문 if, switch / 널병합 연산자 ?? (0) | 2023.04.14 |
[JS] 2023-04-13 (목) 출력 (0) | 2023.04.13 |
[JS] Date 날짜 관련 함수 (0) | 2023.04.13 |