So I have this code which should count occurrences of the numbers that are inputted with an array.
  let counts = {};
  for (let i = 0; i < arr.length; i++) {
    let num = arr[i];
    counts[num] = counts[num] ? counts[num] + 1 : 1;
  }
I don't get why it sorts the input that I provide? For example if I input [1,3,2] on the output, my object says:
1:1 2:1 3:1
Thanks in advance.
 
     
    