Often in JS used in the array, such as multiple names of the same input, if dynamically generated, the submission needs to determine whether it is an array.
if (document.mylist.length!= "undefined") {} This usage is incorrect.
The correct is if (typeof (Document.mylist.length)!= "undefined") {}
Or if (!isnan (Document.mylist.length)) {}
The typeof operand is undefined, and the return is "undefined".
The number of operands is typeof (x) = "Number"
String typeof (X) = "string"
Boolean value typeof (X) = "Boolean"
objects, arrays, and Null typeof (X) = "Object"
function typeof (X) = "function"
The typeof operator returns a String that represents the data type of an expression.
Possible strings are: "Number", "string", "Boolean", "Object", "function", and "undefined".
Such as:
Alert (typeof (123));//typeof (123) returns "Number"
Alert (typeof ("123"));//typeof ("123") returns "string"
typeof operator
Returns a string that is used to represent the data type of an expression.
typeof[() expression[]];
The expression parameter is any expression that needs to find the type information.
Description
The typeof operator returns the type information as a string. There are six possible typeof return values: "Number," "String," "Boolean," "Object," "function," and "undefined."
Parentheses in the typeof syntax are optional.
Current 1/2 page
12 Next read the full text