Generation

generate functionMon, 14 Nov 2022

sleepsort

function sleepSort(nums, callback) { nums.forEach(function(num) { setTimeout(function() { callback(num); }, num); }); } function print(num) { console.log(num); } sleepSort([3, 1, 5, 4, 2], print);

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant