sort array with negative numbers
var arr = [10, 5, 40, 25, -3412, 4212, -107.578, 97.453];
function sortNumber(a, b) {
return a - b;
}
return arr.sort(sortNumber);
Also in JavaScript:
- null undefined javascript
- js validate mongodb id
- make a if in jsx
- difference between React Native and React
- angular reactive form get form control template
- jest spy on class method
- javascript array add
- react native class component template keyboard shortcut
- regular expression number from 1 to 100
- jQuery - Get Content and Attributes
- convert milliseconds to minutes and seconds javascript
- javascript duplicate an array
- js queryselector names
- email regex javascript
- select2 disable search
- require jquery tampermonkey
- github redux devtools
- javascript get first 2 char
- reacts mos twanted
- how to get the number of days in a month in javascript
- nextjs svg npm
- jquery siblings
- how to print NODE_PATH
- javascript check type of variable var