Reputation: 37504
Trying to deepen my knowledge of JS, can someone tell me what this does/is please?
jQuery = $ = this.jQuery;
What exactly does two equal signs do here?
Upvotes: 0
Views: 105
Reputation: 407
It is simply "stacking" the equals sign as you know it ;)
The example you have could be rewritten to
$ = this.jQuery;
jQuery = $;
I.e. both variables "jQuery" and "$" is set to the value to the right. (So it saves space and might be more clear that both vars are set to the same value.
Upvotes: 0
Reputation: 227310
That assigns this.jQuery
to $
, and then assigns $
to jQuery
.
This works because when assigning a value, it returns the value it just assigned, so another variable can be set to it.
Upvotes: 3
Reputation: 35106
assigned this.jQuery to $ and jQuery
why not just try it out?
Upvotes: 0