Mode entretien. Minuteur de 5 min, sans indices ni autocomplétion
Min and max
FacileArrays5 min
Write a function minMax(numbers) that returns an object { min, max } with the smallest and the largest number of an array. The array is not empty. Do not use Math.min or Math.max.
Exemples
minMax([3, -2, 8, 0])Renvoie { min: -2, max: 8 }
minMax([7])Renvoie { min: 7, max: 7 }
Chargement de l'éditeur...
- Entrée
minMax([ 3, -2, 8, 0 ])Attendu{ min: -2, max: 8 } - Entrée
minMax([ 7 ])Attendu{ min: 7, max: 7 }
Les tests cachés se lancent à la soumission