How does the following code sort this array to be in numerical order?
var array=[25, 8, 7, 41] array.sort(function(a,b){ return a - b })
run this code. You can see the exact step by step sorting process from the beginning to the end.
var array=[25, 8, 7, 41] var count = 1; array.sort( (a,b) => { console.log(`${count++}). a: ${a} | b: ${b}`); return a-b; }); console.log(array);