Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How does js add elements to Array array
How does js add elements to Array array
Addition of array elements?

1 . arrayobj . push([item 1[item 2[。 . . [itemN]]]); //Adds one or more new elements to the end of the array and returns the new length of the array.

2 . arrayobj . un shift([item 1[item 2[。 . . [itemN]]]); //When one or more new elements are added to the array, the elements in the array will automatically move back and return to the new length of the array.

3.arrayObj.splice(insertPos,0,[item 1[,item2[,。 . . [,itemN]]]); //Insert one or more new elements in the specified position of the array, and the elements in the inserted position will automatically move back and return to "". ?

I. Basic concepts

1.JavaScript is a literal translation scripting language, which is a dynamically typed, weakly typed and prototype-based language with built-in support types. Its interpreter is called JavaScript engine, which is a part of the browser and widely used in the scripting language of the client. It was first used in HTML (an application under standard generalized markup language) web pages to add dynamic functions to HTML web pages. ?

2. 1995, Brendan Eich of Netscape Company first designed and implemented it on Netscape Navigator browser. Because Netscape cooperated with Sun, Netscape management wanted it to look like Java, so it was named JavaScript. But in fact, its grammatical style is close to Self and Scheme.

3. In order to gain technical advantages, Microsoft introduced JScript and CEnvi introduced ScriptEase, which can run on the browser like JavaScript. In order to unify the specification, JavaScript is also called ECMAScript because it is compatible with ECMA standard.

Two. ingredient

Javascript constitutes a complete JavaScript implementation, which consists of the following three different parts:

ECMAScript, document object model (DOM) and browser object model (BOM).