Last active
March 11, 2019 15:23
-
-
Save bapHyv/f2b293bf644a1448d6cff0954a44a114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let myArr = ['Hannah', 'Guilhem', 'Louis', 'Laura', 'Amine', 'Baptiste', 'Cloé', 'Enzo', 'Fabien', 'Florian', 'Guillaume', 'Jean-Baptiste', 'Jean-Maxime', 'Jim', 'Jonathan', 'Kevin', 'Marlene', 'Nathalie', 'Nicolas', 'Nizar', 'Perrine', 'Sarah', 'Stephane Vivier', 'Stephane Jacot', 'Stephane Van Pe', 'Stephane Barucq', 'Sylène Manusset', 'Vanessa', 'Yann']; | |
| let arrSuj = []; | |
| let arrLen = myArr.length; | |
| let compteur = 0; | |
| let compteurGroupeDeQuatre = 1; | |
| console.log('GROUPE 1'); | |
| console.log(' '); | |
| function inputTopic() { | |
| arrSuj.push(document.getElementById('maZoneDeTexte').value); | |
| console.log(arrSuj); | |
| document.getElementById("maZoneDeTexte").value = ""; | |
| } | |
| function myFunction() { | |
| while (myArr.length != 0) { | |
| if (myArr.length <= 8) { | |
| while (myArr.length != 0) { | |
| let randPick = myArr[Math.floor(Math.random() * myArr.length)]; | |
| console.log(randPick); | |
| myArr.splice(myArr.indexOf(randPick), 1); | |
| compteur++; | |
| if (compteur == 4) { | |
| let randSujetPick = arrSuj[Math.floor(Math.random() * arrSuj.length)]; | |
| console.log('Travaillerons sur le sujet: ' + randSujetPick); | |
| arrSuj.splice(arrSuj.indexOf(randSujetPick), 1); | |
| console.log(' '); | |
| compteur = 0; | |
| } | |
| } | |
| } | |
| let randPick = myArr[Math.floor(Math.random() * myArr.length)]; | |
| console.log(randPick); | |
| myArr.splice(myArr.indexOf(randPick), 1); | |
| compteur++; | |
| if (compteur == 3) { | |
| let randSujetPick = arrSuj[Math.floor(Math.random() * arrSuj.length)]; | |
| console.log('Travaillerons sur le sujet: ' + randSujetPick); | |
| arrSuj.splice(arrSuj.indexOf(randSujetPick), 1); | |
| console.log(' '); | |
| compteur = 0; | |
| } | |
| if (myArr.length == 14) { | |
| console.log(' '); | |
| console.log('GROUPE 2'); | |
| console.log(' '); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| <script src="JSfile.js"></script> | |
| </head> | |
| <body> | |
| <input id="maZoneDeTexte" type="text" name="fname"> | |
| <button onclick="inputTopic()">Add topic</button> | |
| <button onclick="myFunction()">Random groups</button> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment