why $ symbol is used in javascript? i want to know what it specify?
The $() function The dollar function, $(), can be used as shorthand for the getElementById function. To refer to an element in the Document Object Model (DOM) of an HTML page, the usual function identifying an element is: document.
It's an arrow function, newly defined in ES6. An arrow function expression has a shorter syntax than a function expression and does not bind its own this, arguments, super, or new. target. Arrow functions are always anonymous.
A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function's scope from an inner function.
Symbol is a primitive data type of JavaScript, along with string, number, boolean, null and undefined. It was introduced in ECMAScript 2015, so just a few years ago. It's a very peculiar data type. Once you create a symbol, its value is kept private and for internal use.
You may be looking at jQuery code. $ is a variable (in jQuery's case it's a shortcut for 'jQuery').
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With