Home >Web Front-end >JS Tutorial >Analysis of stack issues in JS
We all know that Constructor function needs to be called using the new keyword, so the first letter must be capitalized, but the function does not use such a format. Here are a few examples. Stack problem in JS.
It is taboo to add empty values in the array
The value has been assigned when it is created, which is the initialization Var a = 10;JS will Values whose subscripts are not numeric are filtered out and will not be displayed on the interface, but they still exist in fact // Use subscripts to assign values, otherwise the original data items will be overwritten //Use subscripts to assign values, if not, create new data items//Subscripts can use //Non-numeric subscripts are not counted in the array length , but it can exist. The current array is equivalent to aobject, which does not have the attribute of index, and returns undefined. If the attribute exists, the attribute of the attribute is returned. Value, this is the most basic. The attribute value may be a function or something else
//Pay attention to the variable typeUnshift()Shift()Push()built-in function has its own return value. If it does not return, it will return undefined
indexOf()//This refers to the first positionlastIndexOf()The above two examples illustrate that the search starting point includes your own positionReverse()Sort()The above is the case where sort() does not pass a value. If a parameter is passed to sort(), it can only be the execution context of a functionThe above three forms all achieve the same effect, sorted from small to large
How to make DIV adaptive height
How to use CSS hides the text content of the image background
How to use CSS to hide divs in HTML
The above is the detailed content of Analysis of stack issues in JS. For more information, please follow other related articles on the PHP Chinese website!