From 8d0f5528b464a52ae9b8b4e87e234a68edecf02d Mon Sep 17 00:00:00 2001 From: Abijit-chettri <56419995+Abijit-chettri@users.noreply.github.com> Date: Sat, 3 Oct 2020 16:15:58 +0530 Subject: [PATCH] Add fizzbuzz.js --- .vscode/launch.json | 15 +++++++++++++++ JavaScript/fizzbuzz_1.js | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 JavaScript/fizzbuzz_1.js diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7a9dfa0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/JavaScript/fizzbuzz_1.js b/JavaScript/fizzbuzz_1.js new file mode 100644 index 0000000..ecb3d36 --- /dev/null +++ b/JavaScript/fizzbuzz_1.js @@ -0,0 +1,17 @@ +let fizzBuzz = (n) => { + for (let i = 1; i <= n; i++) { + if(i%3==0 && i%5==0){ + console.log("FIZZBUZZ"); + } + else if (i%3==0){ + console.log("FIZZ"); + } + else if (i%5==0){ + console.log("BUZZ"); + } + else{ + console.log(i); + } + } + } + \ No newline at end of file