JavaScript中的TypedArray.sort()函数
sort()TypedArray对象的方法按升序排列数组的元素并返回它。
语法
其语法如下
arrayBuffer.sort()
示例
<html>
<head>
<title>JavaScript Array every Method</title>
</head>
<body>
<script type="text/javascript">
var typedArray = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]);
document.write("Contents of the typed array: "+typedArray);
document.write("<br>");
var resultantArray = typedArray.sort();
document.write("Resultant Array: "+resultantArray);
</script>
</body>
</html>输出结果
Contents of the typed array: 11,5,13,4,15,3,17,2,19,8 Resultant Array: 2,3,4,5,8,11,13,15,17,19
热门推荐
10 朋友领证祝福语长文简短
11 对睡觉的祝福语简短
12 小考加油文案祝福语简短
13 创业大吉祝福语简短
14 送给员工美好祝福语简短
15 公司年终晚会祝福语简短
16 周末愉快祝福语高级简短
17 徒弟调走祝福语简短语
18 今年节日祝福语简短