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

python - Best design pattern for collection of objects -

android - IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling -

go - serving up pdfs using golang -