From dd6110512bea53823b919b77c6f96d541e9ba2cd Mon Sep 17 00:00:00 2001 From: EleaSimplon Date: Fri, 5 Feb 2021 12:12:20 +0100 Subject: [PATCH] functionx --- fizzbuzz.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/fizzbuzz.js b/fizzbuzz.js index bd1f6cf..bdb7252 100644 --- a/fizzbuzz.js +++ b/fizzbuzz.js @@ -4,12 +4,29 @@ // Make sure to look at test.script.js--that should give you some hints about what is // expected here. -'use strict'; + let fizzbuzz = function (x) { -var fizzbuzz = function (x) { -// -// YOUR CODE GOES HERE -// -}; - -module.exports = { fizzbuzz: fizzbuzz }; + 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) ; + } + + fizzbuzz(2) + fizzbuzz(5) + fizzbuzz(6) + fizzbuzz(11) + fizzbuzz(30) +}; \ No newline at end of file