티스토리 뷰

1. typeof  - 역할

변수가 현재 어떤 타입인지 검사 


2. typeof - 예제

◈ 코드


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var v_num = 100;
var v_st = "가나다";
var v_bool = true;
var v_fun = function() {};
var v_obj = {obj_v1 : 100};
var v_unde;
    
alert(typeof(v_num));
// number
    
alert(typeof(v_st));    
// string
    
alert(typeof(v_bool));
// boolean   
 
alert(typeof(v_fun));    
// function
    
alert(typeof(v_obj));    
// object    
 
alert(typeof(v_unde));
// undefined







댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday