From b2cbf461e5dfa82a4106bc52ffb3fc6ccdc06e3b Mon Sep 17 00:00:00 2001 From: thomas Date: Fri, 5 Feb 2021 12:14:05 +0100 Subject: [PATCH] modif- Maxime --- fizzbuzz.js | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index bd1f6cf..da64707 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -4,12 +4,30 @@ // Make sure to look at test.script.js--that should give you some hints about what is // expected here. -'use strict'; -var fizzbuzz = function (x) { -// -// YOUR CODE GOES HERE -// -}; +let fizzbuzz = function (x) { + + let result; + + if (x %3===0){ + result = 'fizz'} + + if (x %5===0){ + result = 'buzz'} + + if (x %5===0 && x %3===0){ + result = 'fizzbuzz'} + + if (!(x %5===0 || x %3===0)){ + result = (x); + } + +console.log(result) ; + +} -module.exports = { fizzbuzz: fizzbuzz }; +fizzbuzz(2) +fizzbuzz(5) +fizzbuzz(6) +fizzbuzz(11) +fizzbuzz(30)