1. Home
  2. Javascript
  3. Sort array

Assigning array to Float64Array array type lets you correctly sort its numeric values.

let arrayToSort = new Float64Array([10, 23, 5, 456, 11, 1]);
sortedArray = arrayToSort.sort(); // returns [1, 5, 10, 11, 23, 456]
copy
Full Javascript cheatsheet
NordVPN NordVPN