DEV Community

Omkar Rajan Gaikwad
Omkar Rajan Gaikwad

Posted on

Javascript sorting

Did you know javascript is so amazing, you could sort an array with setTimeout function ?πŸ™„

let arr = [10, 100, 650, 25 , 5, 50];

arr.forEach((item) => {
setTimeout(() => console.log(item), item)
});

// output
5
10
25
50
100
650

Top comments (0)