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
| // Version lisible pour débutants | |
| function arrayReplace(tableau, nombreARemplacer, nouvelleValeur) { | |
| const resultat = []; | |
| for(nombre of tableau) { | |
| if (nombre === nombreARemplacer) { | |
| resultat.push(nouvelleValeur); | |
| } else { | |
| resultat.push(nombre); | |
| } | |
| } |
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
| // Version lisible pour débutants | |
| function alternatingSums(tableau) { | |
| let sommePaires = 0; | |
| let sommeImpaires = 0; | |
| for (let i = 0; i < tableau.length; i++) { | |
| if (i % 2 === 0) { | |
| sommePaires = sommePaires + tableau[i]; | |
| } else { | |
| sommeImpaires = sommeImpaires + tableau[i]; | |
| } |
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
| // Version lisible pour débutants | |
| function allLongestStrings(tableauDeChaines) { | |
| let longueurMax = 0; | |
| for (chaine of tableauDeChaines) { | |
| if (longueurMax < chaine.length) { | |
| longueurMax = chaine.length; | |
| } | |
| } | |
| let plusLonguesChaines = []; | |
| for (chaine of tableauDeChaines) { |
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
| // Version lisible pour débutants | |
| function add(...nombres) { | |
| let somme = 0; | |
| for (nombre of nombres) { | |
| somme = somme + nombre; | |
| } | |
| return somme; | |
| } | |
| // Version avancée plus compacte |
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> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>demo html</title> | |
| </head> | |
| <body> | |
| <h3>jeux morpion</h3> |
NewerOlder