Si te fijás en la documentación de MDN de [`Math.max()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) y [`Math.min()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min), te vas a percatar que para los arrays se utiliza [la sintaxis _spread_ (`...`)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax): <!-- begin snippet: js hide: false console: true babel: null --> <!-- language: lang-js --> function mainFunction(){ "use strict"; let i = 1; const severalNumbers = []; while (i<=5){ severalNumbers.push(parseFloat(prompt("Introcuce un número", ""))); // Validar que se trata de un número i++ } document.getElementById("resultB").innerHTML = "El índice del valor más pequeño introducido es " + numbersArray(severalNumbers); console.log(severalNumbers, i); } function numbersArray(severalNumbers){ "use strict"; let maxNumber; maxNumber = Math.max(...severalNumbers); console.log(maxNumber); // console.log(Math.max(severalNumbers)); // pasa por consola el valor máximo del array console.log(Math.max(...severalNumbers), Math.min(...severalNumbers)); return severalNumbers.indexOf(Math.min(severalNumbers)); // return > la posición del valor mínimo del array } <!-- language: lang-html --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>3 FUNCIONES</title> </head> <body> <h2>Working With Functions</h2> <p>First let's invoke the main function...</p> <input type="button" onclick="mainFunction()" value="I SUMMON YOU !!!"> <p id="resultB"></p> </body> </html> <!-- end snippet -->