javascript - use a callback inside a sort function -


i want use callback function when sort method has finished sorting numbers inside array. think must this:

  totals.sort(function(a, b){b - a; continuation()}); 

somehow though, code isn't doing supposed do. therefore wondering wheter or not because of line of code. in case is, can please tell me appropriate way this.

the sort function doesn't accept argument that, can't.

it isn't needed though: sort isn't asynchronous in first place.

just sort array, whatever else want afterwards.

totals.sort(function(a, b){b - a; }); continuation() 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -