Home  >  Article  >  Web Front-end  >  Commonly used methods for arrays in js

Commonly used methods for arrays in js

小云云
小云云Original
2018-03-26 16:52:381342browse

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;
})

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!

Statement:
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
Previous article:js gets server real timeNext article:js gets server real time