I using typeof
to identify the type of an element.
Here is my code:
<script>
alert("before = " + typeof test);
function test(i) {}
alert("after = " + typeof test);
</script>
In output I am seeing as:
before = function
after = function
When the page loads then the function is not yet defined, then the first alert should say undefined
. So why it says function
in my output?