Dodaj tablicę i sortuj

// ادخال قيم الى المصفوفة
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi", "Lemon"); 

//فرز 
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();

const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();
fruits.reverse();

// OR 
// فرز تصاعدي وتنازلي  a=>b b=>a
const points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return a-b});

const points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return b-a});
Xanthous Xenomorph