I tried to sort an array using .sort()
, but the output is not what I expected.
arr = ["0_11_6_comment", "0_3_6_comment", "0_5_4_comment"]
arr.sort();
Here is my expected output:
["0_3_6_comment", "0_5_4_comment", "0_11_6_comment"]
But I am getting this:
["0_11_6_comment", "0_3_6_comment", "0_5_4_comment"]