How to use 'enterprise fizzbuzz' in JavaScript

Every line of 'enterprise fizzbuzz' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
14function getFizzBuzz(obj, arr) {
15 let newArray = [];
16 let sizeOfArray = arr.length;
17 let strOutput = '';
18 for(let i=0; i < sizeOfArray; i++) {
19 strOutput = '';
20 for(let key in fizzbuzz_obj) {
21 if(arr[i] % key === 0) {
22 strOutput += fizzbuzz_obj[key];
23 }
24 }
25 if(strOutput === '') {
26 strOutput = arr[i];
27 }
28 // console.log(strOutput);
29 newArray.push(strOutput);
30 }
31 return newArray;
32}
16function fizzbuzz(n) {
17 for (let i = 1; i <= n; i++) {
18 if (i % 15 === 0) {
19 console.log('fizzbuzz');
20 } else if (i % 3 === 0) {
21 console.log('fizz');
22 } else if (i % 5 === 0) {
23 console.log('buzz');
24 } else {
25 console.log(i);
26 }
27 }
28}

Related snippets