Javascript Typeof





https://www.w3schools.com/js/tryit.asp?filename=tryjs_datatypes_typeof_primitive

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript typeof</h2>
<p>The typeof operator returns the type of a variable or an expression.</p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
typeof "john" + "<br>" + // string
typeof 3.14 + "<br>" + // number
typeof True + "<br>" + // boolean
typeof False + "<br>" + // boolean
typeof x; // undefined
</script>

</body>
</html>


' oppure

https://www.w3schools.com/js/tryit.asp?filename=tryjs_datatypes_typeof_complex


<!DOCTYPE html>
<html>
<body>

<h2>JavaScript typeof</h2>
<p>The typeof operator returns object for both objects, arrays, and null.</p>
<p>The typeof operator does not return object for functions.</p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML =
typeof {Name:'john', age:34} + "<br>" + // object
typeof [1,2,3,4] + "<br>" + // object
typeof Null + "<br>" + // object
typeof Function myFunc(){}; // function
</script>

</body>
</html>












( javascripttypeof.html )- by Paolo Puglisi - Modifica del 17/12/2023