Retrieve Maximum Elements from Array

# Introduction In this lab, we will explore the `maxN` function which is used to return the `n` maximum elements from a given array. We will learn how to use `Array.prototype.sort()`, the spread operator (`...`), and `Array.prototype.slice()` to sort and slice the array in descending order and return the specified number of elements. This lab will help you improve your understanding of manipulating arrays in JavaScript.

|60 : 00

Click the virtual machine below to start practicing