JS/JavaScript

[JS] 10. TypeOf

밍글링글링 2017. 8. 28.
728x90

10_TypeOf.html

<script>
    var myFunction = function(){
        console.log("hello");
    };
    var myObject ={
        foo: "bar"
    };
    var myArray = ["a","b","c"];
    var myArray = "hello";
    var myNumber = 3;
    
    console.log(typeof myFunction); //"function"
    console.log(typeof myObject); //"object"
    console.log(typeof myArray); //"object" --Careful!
    console.log(typeof myString); //"string"
    console.log(typeof myNumber); //"number"
    console.log(typeof true); // "boolean"
    console.log(typeof null); //"obejct" --Careful!
    console.log(typeof undefined); //"undefined"
    console.log(typeof meh); //"undefined" --undefined variable.
</script>
 

728x90

'JS > JavaScript' 카테고리의 다른 글

[JS] 12. scope  (0) 2017.08.28
[JS] 11. This  (0) 2017.08.28
[JS] 09. Function  (0) 2017.08.28
[JS] 08. Object  (0) 2017.08.28
[JS] 07. Array  (0) 2017.08.28

댓글