From 6b977d9489c2f6b55f5f3a5b4d1c02087f47323c Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 11:17:55 +0200 Subject: [PATCH 01/11] modif JS usher_kadio --- .vscode/launch.json | 15 +++++++++++++++ fizzbuzz.js | 26 +++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c125fb7 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Utilisez IntelliSense pour en savoir plus sur les attributs possibles. + // Pointez pour afficher la description des attributs existants. + // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/fizzbuzz.js b/fizzbuzz.js index bd1f6cf..f59198e 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -4,12 +4,28 @@ // Make sure to look at test.script.js--that should give you some hints about what is // expected here. -'use strict'; +"use strict"; -var fizzbuzz = function (x) { -// -// YOUR CODE GOES HERE -// +var fizzbuzz = function(x) { + // declaration de la boucle( init nombre, condition de la boucle et itération) + for (let nombre = 1; nombre <= 50; nombre++) { + // condition "fizzbuzz" si nombre multiple de 3 et 5 + if (nombre % 3 === 0 && nombre % 5 === 0) { + console.log("fizzbuzz"); + + // condition "fizz" si nombre multipe de + } else if (nombre % 3 === 0) { + console.log("fizz"); + + // condition "buzz" si nombre multiple de 5 + } else if (nombre % 5 === 0) { + console.log("buzz"); + + //affiche nombre si pas multiple de 5 ni de 5 + } else { + console.log(nombre); + } + } }; module.exports = { fizzbuzz: fizzbuzz }; From d47995490070c0bba19e12666e6b8e281c976d52 Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 11:25:01 +0200 Subject: [PATCH 02/11] modif JS usher_kadio_2 --- fizzbuzz.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index f59198e..d3a0a0c 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -8,7 +8,7 @@ var fizzbuzz = function(x) { // declaration de la boucle( init nombre, condition de la boucle et itération) - for (let nombre = 1; nombre <= 50; nombre++) { + for (let nombre = 1; nombre <= 100; nombre++) { // condition "fizzbuzz" si nombre multiple de 3 et 5 if (nombre % 3 === 0 && nombre % 5 === 0) { console.log("fizzbuzz"); From 81d7c1e2f4fa893a337f3ccd6dd8c36236c7c793 Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 11:31:26 +0200 Subject: [PATCH 03/11] modif JS usher_kadio_3 --- fizzbuzz.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index d3a0a0c..023d3a0 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -8,22 +8,22 @@ var fizzbuzz = function(x) { // declaration de la boucle( init nombre, condition de la boucle et itération) - for (let nombre = 1; nombre <= 100; nombre++) { - // condition "fizzbuzz" si nombre multiple de 3 et 5 - if (nombre % 3 === 0 && nombre % 5 === 0) { + for (let x = 1; x <= 100; x++) { + // condition "fizzbuzz" si x multiple de 3 et 5 + if (x % 3 === 0 && x % 5 === 0) { console.log("fizzbuzz"); - // condition "fizz" si nombre multipe de - } else if (nombre % 3 === 0) { + // condition "fizz" si x multipe de + } else if (x % 3 === 0) { console.log("fizz"); - // condition "buzz" si nombre multiple de 5 - } else if (nombre % 5 === 0) { + // condition "buzz" si x multiple de 5 + } else if (x % 5 === 0) { console.log("buzz"); - //affiche nombre si pas multiple de 5 ni de 5 + //affiche x si pas multiple de 5 ni de 5 } else { - console.log(nombre); + console.log(x); } } }; From 7ce4342e7ea6b83c9a503004babdd5aae0732c86 Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 11:34:40 +0200 Subject: [PATCH 04/11] modif JS usher_kadio_4 --- fizzbuzz.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index 023d3a0..b0b945c 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -11,19 +11,19 @@ var fizzbuzz = function(x) { for (let x = 1; x <= 100; x++) { // condition "fizzbuzz" si x multiple de 3 et 5 if (x % 3 === 0 && x % 5 === 0) { - console.log("fizzbuzz"); + return ("fizzbuzz"); // condition "fizz" si x multipe de } else if (x % 3 === 0) { - console.log("fizz"); + return ("fizz"); // condition "buzz" si x multiple de 5 } else if (x % 5 === 0) { - console.log("buzz"); + return ("buzz"); //affiche x si pas multiple de 5 ni de 5 } else { - console.log(x); + return (x); } } }; From 8aeb53bb5e0cfeaf117eb12f3d0860553eff54b3 Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 11:38:12 +0200 Subject: [PATCH 05/11] modif JS usher_kadio_5 --- fizzbuzz.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index b0b945c..11c467a 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -11,19 +11,19 @@ var fizzbuzz = function(x) { for (let x = 1; x <= 100; x++) { // condition "fizzbuzz" si x multiple de 3 et 5 if (x % 3 === 0 && x % 5 === 0) { - return ("fizzbuzz"); + return "fizzbuzz"; // condition "fizz" si x multipe de } else if (x % 3 === 0) { - return ("fizz"); + return "fizz"; // condition "buzz" si x multiple de 5 } else if (x % 5 === 0) { - return ("buzz"); + return "buzz"; //affiche x si pas multiple de 5 ni de 5 } else { - return (x); + return x; } } }; From 14741906da3f2dab06ca12d6468ccf43aea581b1 Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 11:44:11 +0200 Subject: [PATCH 06/11] modif JS usher_kadio_5 --- fizzbuzz.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index 11c467a..218858b 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -7,21 +7,13 @@ "use strict"; var fizzbuzz = function(x) { - // declaration de la boucle( init nombre, condition de la boucle et itération) - for (let x = 1; x <= 100; x++) { - // condition "fizzbuzz" si x multiple de 3 et 5 + for (let x = 0; x <= 30; x++) { if (x % 3 === 0 && x % 5 === 0) { return "fizzbuzz"; - - // condition "fizz" si x multipe de } else if (x % 3 === 0) { return "fizz"; - - // condition "buzz" si x multiple de 5 } else if (x % 5 === 0) { return "buzz"; - - //affiche x si pas multiple de 5 ni de 5 } else { return x; } From 1363389f25c0bbe92f682ce680dd940bc3cd97ce Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 11:48:17 +0200 Subject: [PATCH 07/11] modif JS usher_kadio_7 --- fizzbuzz.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index 218858b..96fcf00 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -7,7 +7,7 @@ "use strict"; var fizzbuzz = function(x) { - for (let x = 0; x <= 30; x++) { + for (var x = 0; x <= 30; x++) { if (x % 3 === 0 && x % 5 === 0) { return "fizzbuzz"; } else if (x % 3 === 0) { @@ -19,5 +19,6 @@ var fizzbuzz = function(x) { } } }; +fizzbuzz(1) module.exports = { fizzbuzz: fizzbuzz }; From a40667894d0f7e5e9a44fdafb34d63a13fba6f7e Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 11:50:03 +0200 Subject: [PATCH 08/11] modif JS usher_kadio_8 --- fizzbuzz.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index 96fcf00..f9db025 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -7,18 +7,18 @@ "use strict"; var fizzbuzz = function(x) { - for (var x = 0; x <= 30; x++) { - if (x % 3 === 0 && x % 5 === 0) { + for (let i = 0; i <= x; i++) { + if (i % 3 === 0 && i % 5 === 0) { return "fizzbuzz"; - } else if (x % 3 === 0) { + } else if (i % 3 === 0) { return "fizz"; - } else if (x % 5 === 0) { + } else if (i % 5 === 0) { return "buzz"; } else { - return x; + return i; } } }; -fizzbuzz(1) +fizzbuzz(100); module.exports = { fizzbuzz: fizzbuzz }; From aa759077d2e067ac0ffaa7040d5f329589962d78 Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 12:08:16 +0200 Subject: [PATCH 09/11] modif JS usher_kadio_9 --- fizzbuzz.js | 1 - 1 file changed, 1 deletion(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index f9db025..b212bb6 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -19,6 +19,5 @@ var fizzbuzz = function(x) { } } }; -fizzbuzz(100); module.exports = { fizzbuzz: fizzbuzz }; From 419eb1eaedfa25de6f19d8de097223dd23c04608 Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 12:20:06 +0200 Subject: [PATCH 10/11] modif JS usher_kadio_9 --- fizzbuzz.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index b212bb6..5b3ef70 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -7,17 +7,23 @@ "use strict"; var fizzbuzz = function(x) { - for (let i = 0; i <= x; i++) { - if (i % 3 === 0 && i % 5 === 0) { + + + if (x % 3 === 0 && x % 5 === 0) { return "fizzbuzz"; - } else if (i % 3 === 0) { + + } else if (x % 3 === 0) { return "fizz"; - } else if (i % 5 === 0) { + + } else if (x % 5 === 0) { return "buzz"; + + } else { - return i; + return x; } - } + }; +fizzbuzz(2); module.exports = { fizzbuzz: fizzbuzz }; From f717343b931882e8ea7df996523341bc9ebe8e29 Mon Sep 17 00:00:00 2001 From: usher kadio Date: Mon, 6 Apr 2020 12:23:46 +0200 Subject: [PATCH 11/11] modif JS usher_kadio_11 --- fizzbuzz.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index 5b3ef70..970a8fc 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -15,7 +15,7 @@ var fizzbuzz = function(x) { } else if (x % 3 === 0) { return "fizz"; - } else if (x % 5 === 0) { + } else if (x % 5 === 0) { // return "buzz";