diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 6f3a291..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "liveServer.settings.port": 5501 -} \ No newline at end of file diff --git a/back/fonctions.js b/back/fonctions.js index 45bf103..b7fece7 100644 --- a/back/fonctions.js +++ b/back/fonctions.js @@ -156,8 +156,19 @@ function getImg2(categorie, indice){ // function for random index of a function - function getIndex(){ - + function getIndex(tableauDentiers){ + if (tableauDentiers.length == 0){ + return -1; + } + const indiceAleatoire = Math.floor(Math.random() * tableauDentiers.length); + tableauDentiers.splice(indiceAleatoire, 1); + console.log(tableauDentiers); // Affiche : [1, 2, 4, 5] + return indiceAleatoire; } + document.addEventListener('DOMContentLoaded', ()=> + { + const tableauDentiers = [1, 2, 3, 4, 5]; + } + ) diff --git a/back/indextest.html b/back/indextest.html index ccd28e9..d3592a8 100644 --- a/back/indextest.html +++ b/back/indextest.html @@ -6,6 +6,6 @@
- +