javascript的reverse,sort方法,concat方法

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title</title>
</head>
<body>
<script>
//1.reverse,sort
var ar=[1,6,3,8,100];
// ar.reverse();
// console.log(ar);//[100, 8, 3, 6, 1]
// ar.sort(mysort);
// console.log(ar);//[1, 3, 6, 8, 100]
// function mysort(a,b) {
// return a-b;
//
// }
//2.concat方法
console.log(ar.concat(66,99))


</script>

</body>
</html>
posted @ 2020-01-28 18:42  Stary_tx  阅读(172)  评论(0编辑  收藏  举报