Hi,
How do we know whether or not the bling($) is required in a JS statement?
Some statements seem to not work without it, and others don’t work if i add it.
Hi,
How do we know whether or not the bling($) is required in a JS statement?
Some statements seem to not work without it, and others don’t work if i add it.
The jQuery library uses it as the name of its main function so you don’t have to write jquery
every time. If you use jQuery, then you use it a lot. If you don’t use jQuery, you don’t. It’s not part of JS, it’s just defined by jQuery.
You can define it yourself for something else if you want. That’s not a very good idea as it’s commonly understood to refer to jQuery. If you do that and use jQuery, it’ll break jQuery, because you’ll have redefined what $
is. Example:
function $(name) {
return 'Hello, ' + name + '!';
}
> $('Dan')
'Hello, Dan!'