var arr = [undefined,null, NaN , Infinity];
sample.sort((a,b)=> a-b)
Answer : [Infinity, NaN, null, undefined]
sample