Difference between sort compare function in Javascript

前端 未结 0 1840
粉色の甜心
粉色の甜心 2020-12-24 08:15

var arr = [undefined,null, NaN , Infinity];

sample.sort((a,b)=> a-b)

Answer :  [Infinity, NaN, null, undefined]

sample

相关标签:
回答
  • 消灭零回复
提交回复
热议问题