Exécuter
❯
Exécuter le code
Ctrl+Alt+R
Enregistrer le code
Ctrl+Alt+A
Changer d'orientation
Ctrl+Alt+O
Changer de thème
Ctrl+Alt+D
<!DOCTYPE html> <html> <body> <h2>Tri des tableaux JavaScript</h2> <p>Le plus grand nombre est<span id="demo"></span>.</p> <script> const points = [40, 100, 1, 5, 25, 10]; document.getElementById("demo").innerHTML = myArrayMax(points); function myArrayMax(arr) { let len = arr.length; let max = -Infinity; while (len--) { if (arr[len] > max) { max = arr[len]; } } retourner max; } </script> </body> </html>