Javascript - $ Symbol

This is a question for me when I am working with JQuery. What is a $.XXX function? Is $ a variables or object?

In Javascript, $ is commonly use as a short hand for variable definition and function declaration. In layman term, it is just a name.

Javascript variables must start with a letter, underscore or dollar sign.

Thus, we can have a function variable like

var $ = function(){
          alert("$ function");

Then, you can call this function as $()


Now, back to jQuery, by default, jQuery uses $ as a shortcut for "jQuery"

That means

jQuery(''); === $('');

More readings:


Popular posts from this blog

FFMPEG - Creating timelapse with FFMPEG with JPEG

MP4 File Format Part 1