for example
var arr = [1, 3, 6, 10, 2, 7, 9];
after sorting
var arr = [1, 2, 3, 6, 7, 9, 10];
! In particular, I wrote it correctly! It"s not what you think. Increase first and then decrease! Those who take it for granted and step on other people"s questions are afraid that they are not doing too many conventional questions!
I met this when I went out for an interview, and that person specially stressed that it was not an increase and then a decrease!
! You can"t write
in a pure native method instead of using the sort method.