Why is the jQuery close function for the "jQuery Color" extension set to undefined as the second parameter?

Possible duplicate:
JavaScript function with undefined parameter

I am looking for jQuery Color source code here

http://code.jquery.com/color/jquery.color-2.1.0.js

And I found that the close function takes an undefined value as the second parameter. See below:

(function( jQuery, undefined ) { var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", // plusequals test for += 100 -= 100 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, // a set of RE that can match strings and generate color tuples. 

Or you can see it in the source code. Look at the second parameter.

What I want to know is why the second parameter is undefined?

I think this is an approach that strictly sets up a function to accept only one parameter.

I'm right? Or can someone help me?

+4
source share
1 answer

In case any other part of the code assigns some value to the name undefined . Closing is actually called with just one argument, like:

 (function(jQuery, undefined) { // ... })(jQuery); 

This ensures that undefined actually bound to undefined at close.

+5
source

Source: https://habr.com/ru/post/1442366/


All Articles