Javascript Sort

Sort means you need to arrange your multiple data in such a way that based on given criteria that individual data item will be please on top of another item or placed on the bottom of another item.

const items = [1,5,4,3,2];

// when you perform sort it will work based on condition and arrage items

console.log(items); // result: [1, 2, 3, 4, 5];

Generally programming language is programmed to sort from small value to large value. In above example its clearly understanable that 1 is smallest value so its placed first and 5 is largest among them so its at last.

Popular Javascript Sort articles and code snippets

Related Articles

js interview questions