Home > front end >  I want to ask about the js code is what mean
I want to ask about the js code is what mean

Time:10-23

! Function (a) {
JQuery. Fn [a]=function (e) {
Return e? This. Bind (" resize, "(t=e, function () {
Var e=this, a=the arguments;
i? ClearTimeout (I) : n& & T.a pply (e, a), I=setTimeout (function () {
N | | t.a pply (e, a), I=null}
, o | | 100)}
) : this. The trigger (a);
Var t, o, n, I}
} ((jQuery, "smartresize"));

This code is the first piece of code page configuration,! Function (a) I can understand that, but the jQuery. Fn [a] what is this wording, said what mean? And the last ((jQuery, "smartresize")); This is a piece of code written?

CodePudding user response:

I'm also a little look not to understand, don't know whether I write wrong, anyway, I have seen this kind of writing
JQuery. Fn [a]=function () {} : this means under the jQuery object of FM object
[a] is to modify (add) does not exist when the a: fn object is a variable, the writing is like
Var obj={}
Var a='back'
Obj [a]=666;//obj [a]===obj. Back
The console. The log (obj)//{666} back:

((jQuery, "smartresize")); This should be executed immediately function, then by value,
Double parentheses (()) this kind of writing not seen, but are generally use parentheses ();


CodePudding user response:

Function (a) {} ((jQuery, "smartresize")), the first layer brackets represent function calls such as f=function (a) {}; F (XXX); The first layer equivalent to f () brackets brackets; The second bracket is (jQuery, "smartresize") is the first layer of the parameters of the brackets, equivalent to f (XXX XXX) parts, XXX is a function call returns a value that jQuery smartresize function return values

JQuery. Fn [a] is that under the JQuery object of fn a attribute, this property is a function that is equivalent to one under the JQuery fn [a] the assignment of a new function




  • Related