JavaScript
[JavaScript] 자료형 검사(typeof 연산자)
사악미소
2015. 6. 21. 16:30
반응형
■ 자료형 검사(typeof 연산자)
자바스크립트는 숫자, 문자열, 불리언 같은 것을 자료형(자료의 형태)이라고 부른다. 자료형을 확인하려면 typeof 연산자를 사용해야 한다.
ex01.php |
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>연습문제</title> <script type="text/JavaScript"> alert(typeof('Strig')); alert(typeof('273')); </script> </head> </html> |
출력결과 |
typeof 연산자를 사용해 모든 자료형을 살펴보자.
ex02.php |
<html> |
출력결과 |
반응형