Good day to all. I just started to learn javascript and faced such a thing.

In the textbook by Ilya Kantor there is such a moment. enter image description here

Essence of the question. If you do not declare any variables and set the alert(typeof $); code alert(typeof $); , then the alert function will show the type "function" in the window. Where can I read about it or is it a design language mistake? After all, he had to issue undefined .

    1 answer 1

    In Chrome, the console provides Command line api

    One of the functions provided by the console: $(selector) , is a synonym for the document.querySelector() function


    Based on the foregoing, the result of typeof $ will depend on the particular browser and api that it provides, for example, for EDGE result will be the expected undefined , but in FF, the same function will be.


    You can define a built-in function or a library by simply calling toString : in the case of a library function, its code will be output; in the case of a built-in function, it will be a string containing the [Command Line API] or [native code]