I have been going through some jQuery functionality.
Can any one please give me some idea of what the difference is between the use of $
and $$
?
$* Stores all the arguments that were entered on the command line ($1 $2 ...). "$@" Stores all the arguments that were entered on the command line, individually quoted ("$1" "$2" ...).
General Usage Rules In America, Canada, Australia and New Zealand, the general rule is that double quotes are used to denote direct speech. Single quotes are used to enclose a quote within a quote, a quote within a headline, or a title within a quote.
The difference between “{}” and “[]” is that {} is an empty array while [] is a JavaScript array, but there are more! In JavaScript, almost “everything” is an object. All JavaScript values, except primitives, are objects. Therefore if you understand objects, you understand JavaScript.
But I bet you're curious about how they're different, why else would you be here? The main difference between the two is: Quotation marks are used to report speech. An apostrophe is used for making contractions and possession.
$
and $$
will work on any web page (if jQuery is not included also) on Google Chrome, Firefox and Safari browsers where $
returns first element of selector passed.
Here,
$ is document.querySelector
$$ is document.querySelectorAll
They are native functions of Google Chrome and Firefox browsers, you can see $
and $$
definition in Safari as well.
Open Google in any of Google Chrome, Firefox or Safari, and open Developer Tools to check these results... (why Google, because they won't use jQuery or Moo tools)
$('div'); // returns first DIV in DOM
$$('div'); // returns all DIVs in DOM
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