typeof a variable : typeof : Operators JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Operators » typeof »

 

typeof a variable

















<html>
<head>
<title>Debug Example</title>
<script type="text/javascript">

function aFunction(iNum1) {
    if (typeof iNum1 == "number" ){
       alert("number");
    }

    if typeof iNum1 == "string") {
        alert("string");
    }
}
aFunction("a");
aFunction(1);
</script>
</head>
<body>
</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Operators
» typeof