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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -