-2

jQuery library is not used in google.com When we type $ in Console of google.com and hit enter, we can see

function $(selector, [startNode]) { [Command Line API] }

But here in Stackoverflow, since jQuery library is used, when we type "$" we can see :

function (a,b){return new n.fn.init(a,b)}

What is the difference between the $ we see in console for those where jQuery is not used and where Jquery is used?

Does one have more benefits than the other? As per my knowledge, $ is jQuery's shorthand.

Lelio Faieta
  • 6,457
  • 7
  • 40
  • 74
user2975747
  • 107
  • 7
  • 1
    http://stackoverflow.com/questions/11778477/variable-in-chrome – robertklep Jan 12 '17 at 10:53
  • 3
    Anyone can declare a variable `$`. Google could have one definition for it today and something else tomorrow. What's the point of this question? – T J Jan 12 '17 at 10:56
  • have you hit the `$$` in stackoverflow? – Jai Jan 12 '17 at 10:56
  • 2
    "[Many JavaScript libraries use `$` as a function or variable name, just as jQuery does...](https://api.jquery.com/jquery.noconflict/)" – GSerg Jan 12 '17 at 10:58
  • To know if jQuery library is used or not, i was using jQuery's shorthand $. But I was wrong – user2975747 Jan 12 '17 at 11:02

1 Answers1

0

It is not uncommon practice to adopt $ as an alias for

  • getQuerySelector
  • getQuerySelectorAll

$ is a valid function name and it can name any new function or alias any existing function.

Rounin
  • 27,134
  • 9
  • 83
  • 108