• 코드:
​x
 
1
<!DOCTYPE html>
2
<html lang="ko">
3
​
4
<head>
5
    <meta charset="UTF-8">
6
    <title>jQuery Utility Method</title>
7
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
8
    <script>
9
        $(function() {
10
            $("button").on("click", function() {
11
                $("#text")
12
                    .html($.isArray([]) + "<br>")                           // true
13
                    .append($.isArray(30) + "<br>")                         // false
14
                    .append($.isFunction(new Function()) + "<br>")          // true
15
                    .append($.isFunction("문자열") + "<br>")               // false
16
                    .append($.isNumeric(100) + "<br>")                      // true
17
                    .append($.isNumeric([7]) + "<br>")                      // false
18
                    .append($.isEmptyObject({}) + "<br>")                   // true
19
                    .append($.isEmptyObject({name: "홍길동"}) + "<br>")        // false
20
                    .append($.isPlainObject(new Object()) + "<br>")         // true
21
                    .append($.isPlainObject(new Object("문자열")) + "<br>")    // false
22
                    .append($.isWindow(window) + "<br>");                   // true
23
            });
24
        });
25
    </script>
26
</head>
27
​
28
<body>
29
​
30
    <h1>특정 타입 검사 메소드</h1>
31
    <button>타입 검사!</button>
32
    <p id="text"></p>
33
    
34
</body>
35
​
36
</html>