Home > Web Front-end > JS Tutorial > body text

Commonly used methods for arrays in js

小云云
Release: 2018-03-26 16:52:38
Original
1381 people have browsed it

This article mainly shares with you the commonly used methods of arrays in js, hoping to help everyone.

arage.sort() is used directly and the default is ascending order.

Please note that


This only shows that sort can only Recognizing the first unicode character at the beginning still cannot perform ascending order operations

For true ascending order, you must use another form of sort

arage.sort(function(x,y){

return x-y;

})


The real descending order is just to reverse x and y and subtract them It’s

arrage.sort(function(x.y    ){
    return y-x;
})
Copy after login

concat This is the fusion of arrays, an array of two people--and an array of 4

Related recommendations:

js Array functions and precautions

The above is the detailed content of Commonly used methods for arrays in js. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template