javascript
Published on January 26, 2024By DeveloperBreeze
// Array of numbers
const numbers = [4, 2, 8, 1, 6];
// Sorting the array in ascending order
const sortedNumbers = numbers.sort((a, b) => a - b);
// Logging the sorted array
console.log('Sorted Array:', sortedNumbers);
Comments
Please log in to leave a comment.