Copy Code code as follows:
var arrayobj=["www", "xxx", "ddd"];
var ww=$.map (arrayobj,function (i) {
return i;
}). Join (",");
Console.log (WW);
var tt=$ (": CheckBox"). Map (function () {
return this.value;
}). Get (). Join (",");
Console.log (TT);
jquery has a concept called "class array", such as $ (": CheckBox"), when you fetch a collection, there are some properties of the array, but the instancseof array is still false. But Var a=$ ("Li"). Get () does this, and then the instancseof array returns TRUE.
The function of map () is mainly two steps, the first step is traversal, the second step is to replace.
For Instanceof and typeof, formerly used occasionally, especially typeof used more, today, the study of ext source, many places are used to instanceof, suddenly feel that they are similar but also should have their differences, online read some articles, Have a certain understanding of the relationship between them.
Both instanceof and typeof can be used to determine whether a variable is empty or what type of variable it is.
typeof is used to get the type of a variable, typeof generally can only return the following results: number,boolean,string,function,object,undefined. We can use TypeOf to get the existence of a variable, such as if (typeof a!= "undefined") {}, and not to use if (a) because if a does not exist (not declared) there will be an error, for array, A special object such as Null uses TypeOf to return object, which is the limitation of TypeOf.
If we want to get an object to be an array, or to determine whether a variable is an instance of an object, choose to use instanceof. Instanceof is used to determine whether a variable is an instance of an object, such as the Var a=new array (); alert (a instanceof array); Returns true while alert (a Instanceof object) Also returns true, because the prototype of the array is object. Again, the function test () {};var a=new test (), alert (a instanceof test) returns True.
When it comes to instanceof, we have to insert one more question, which is the arguments of the function, and we all probably think that arguments is an array, But if you use instaceof to test, you will find that arguments is not an array object, although it looks like it.