OneCompiler

sort array simple way

159

let arr = [5, 2, 9, 1, 5, 6];

// Sorting the array in ascending order
let sortedArr = arr.sort((a, b) => a - b);

console.log(sortedArr); // Output: [1, 2, 5, 5, 6, 9]