Quick actions

cmd+k|ctrl+k

Navigation

Languages

JS Sort Not For Number, Except With Adding Function

Snippet info

Language

JavaScript

Visibility

public

Author

ubaidillah.hf

Created

2021-09-09T08:14:08.036948Z

Updated

2021-09-09T08:14:08.036948Z

const numArr = [1,21,30,4];

console.log(numArr.sort(function (a, b) {  return a - b;  }));
INFO