Array reconstruction method javaScript

1.push (p1, p2 ...); stack, add the last element in the array surface

  Parameters: the element to be pushed onto the stack
  Return Value: length of the array;

2.pop (); the last element of the stack pop

  Parameters: none;

  Return Value: the pull element

result:

shift (); the team, the first element of the team

  Parameters: none

  Returns: the team element

operation result:

sort (comparator); queuing

  a comparator for the comparison function, a function can accept two values a, b; b is located when a return to the previous
  comparator (a, b);

        With minimal code, completion can be freely selected in accordance with the object id / name / age / grade to ascending or descending order

    

    Sort Results:

    

Reconstruction Sort ();

  Use bubble sort

  

 

Guess you like

Origin www.cnblogs.com/ys199610/p/11411001.html