myArray = new Array(1, 4, 3, 2, 7, 6, 5, 9, 8, 10, 0)
document.write("<pre>")
document.write("myArray.toString()\t:\t\t")
document.write(myArray.toString()+"")
document.write("myArray.join('-')\t:\t\t")
document.write(myArray.join ("-")+"")
document.write("myArray.reverse()\t:\t\t")
document.write(myArray.reverse()+"")
document.write("myArray.sort()\t\t:\t\t")
document.write(myArray.sort()+"")
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
Minimum and maximum
Total
Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
Average
Just divide
sum
by the number of array elements: