Line 512: A class2type appears.
Search for this variable globally in jquery.
The meaning of this code is to divide a string of strings into arrays by spaces, and use each to iterate through the array to initialize the Class2type.
The end result should be this.
{
"[Object array]": "Array",
"[Object Boolean]": "Boolean",
"[Object Date]": "Date",
"[Object Function]": "Function",
" [Object number]": "Number",
"[Object Object]": "Object",
"[Object RegExp]": "RegExp",
"[Object String]": "String"
}
in return 512 line: Tostring.call (obj) What is the meaning of.
tostring.call (obj) ===object.prototype.tostring (). Call (obj)
Example:
Object.prototype.toString (). Call ("Guoyansi") ===object.prototype.tostring (). Call (New String ("Guoyansi"))
=====>[object String]
It should be easy to analyze the type as a whole now. The parameter here is very strange. obj is obviously the meaning of an object.
but we're not going to just pass on the object to judge,
Example: $.type ("Gys")
according to the above analysis, "Gys" is an instantiation of the new String ("Gys"), the desired "gys" can be understood as an object,
so obj is not unreasonable as a formal parameter name.
when the type passes null (an empty object) when it is called, it is converted directly to the corresponding original string "null" by String ().
The type parameter is not NULL, it is first judged if there is a corresponding member in the Class2type, and if there is a return member value, object is returned ,
For example:
when we pass in our custom objects, we return an object.