In javascript, what are the common methods for arrays ?, Javascript Array

Source: Internet
Author: User

In javascript, what are the common methods for arrays ?, Javascript Array

Answer:

Push

Pop

Shift

Unshift

Join

Sort

Concat

Reverse

Splice

Slice

IndexOf


What is this representation in the javascript array?

The comma operator executes the expressions on both sides of the expression from left to right and obtains the value of the expression on the right.
So a [] is actually a [1], and the first 1 has no effect.
Of course, a [1] [1] and a [1] are completely different.

The most common comma is used in the for loop.
For (I = 0; I <10; I ++, j ++)
{
K = I + j;
}
At the end of each loop, the for statement only allows a single expression to be executed ., The operator is used to allow multiple expressions to be treated as a single expression, thus avoiding this restriction.

What are the arrays in javascript?

I don't understand what you mean.
There is only one array in js. There are three defining methods.
Fruit = new Array (3); // fruit = new Array ();
Fruit [0] = "apple ";
Fruit [1] = "Pears ";
Fruit [2] = "orange ";

Fruit = new Array ("apple", "Pear", "orange ");

Fruit = ["apple", "Pear", "orange"];

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.