Array push, pop, shift, unshift
- If the array is empty, the return value is "undefinied".
- If the last element is an array, pop () completely removes the element and returns an array.
array.push () inserts one or more elements at the end of the array and returns the new length of the array.
- When push inserts multiple elements, each of these elements is inserted in the order in which it is noted in the call.
- If an element inserted with push is an array, array.push () inserts this array as an element.
nums.push ("FOUR", ["GREEN", "BLUE", "YELLOW"]) adds the elements "FOUR" and "[" GREEN "," BLUE "," YELLOW "]" to the end of the array nums one and gives in len returns the new length of the array.[Log] nums ONE, TWO, THREE, FOUR, GREEN, BLUE, YELLOW [Log] nums len 5 [Log] nums  
Even though push () can insert an array into an array - to connect the two arrays together is array.concat () the efficient method of choice. With push (), each element would have to be appended to the first array individually in a loop or iteration.
shift () and unshift () work equivalent to push and pop, but not at the end of the array, but at the beginning.
- If the first element of the array itself is an array, shift () returns the array to the return value.
assigns the value of the first element of the variable elem and removes the first element from the array colors.[Log] colors Gray, green, blue [log] elem Lemon yellow, scarlet red, sky blue [Log] colors.length 3
unshift () works like array.push (), but starts at the beginning of the array. array.unshift () can insert one or more elements at the beginning of the array.
Passes the call unshift () multiple arguments, the elements are inserted from right to left at the beginning of the array.let cars = ["Opel", "Ford", "Fiat"]; let newcars = cars.unshift ("Renault", "Peugeot"); console.log ("cars" + cars); console.log ("cars.length" + cars.length); [Log] cars Renault, Peugeot, Opel, Ford, Fiat [Log] cars.length 5
- Common sense can be learned
- Biorhythm Theory Right or Wrong
- The Avengers is considered science fiction
- What are i VTEC engines
- What is the synonym for purpose
- What are the top Reddit hacks
- How did Alexander attack Persia
- What is saffron milk
- Risky decisions are bad
- You need MapleStory M Mesos
- What is plutonium made of
- Where was your service dog trained?
- What type of sensor can detect microplastics
- When is the next leap year
- Can someone explain the Zerodha trading terminal to me
- During the pile we can eat fish
- Steel is the best metal for swords
- Are free people more rational
- Why are people aromantic
- How good is Infosys
- What are the benefits of kahwa tea
- Why did Winston Churchill hate Indians
- Is PEC better than NIT Jalandhar
- What are the qualification grades for CLAT