+ 3
Can any one explain me this theory of sorting an array
let values = [144,248,169,276,340,96,47,24,68,194]; console.log(values) //console.log(values.sort()) values.sort((a,b)=>console.log("a=",a,"b=",b,"a-b=",a-b)) console.log(values)
2 Respuestas
+ 2
I think javascript engine might assuming a-value as b-value and b-value as a-value(like (a, b) => a=248,b=144) instead actual assumption might be (like (a, b) => a=144,b=248)....plz help me i gonna mad by this algorithm or javascript engine...
+ 1
Oops! I got a answer where it's javascript engine in sololearn app which assuming a-value as b-value and b-value as a-value