what is $ for? in JavaScript?


I've seen this% $ much in JavaScript libraries, for example:

$.fn._fadeIn = $.fn.fadeIn;
asked by Jesus Rolando 19.10.2017 в 20:15

1 answer


Refers to methods from the most popular JavaScript libraries (jQuery, ProtoType ...) $ is simply a valid JavaScript identifier.

Prototype, jQuery, and most javascript libraries use the $ as the primary base object (or function). Most of them also have a way to forgo the $ so that it can be used with another library that uses it. In that case, you use jQuery instead of $ . In fact, $ is just a shortcut for jQuery.

answered by 19.10.2017 в 20:44