showing results for - "fizzbuzz hackerrank solution javascript"
Katherine
22 Mar 2016
1function fizzBuzz2(n) {
2  for (let i = 1; i <= n; i++) {
3    let str = "";
4
5    if (i % 3 === 0) str += "fizz"
6    if (i % 5 === 0) str += "buzz"
7    if (str === "") str = i;
8  
9    console.log(str);
10  }
11}
12
Aicha
01 May 2017
1for (i=1; i<=100; i++) {
2    console.log((i%3==0&&i%5==0)?"FizzBuzz":(i%3==0)?"Fizz" : (i%5==0)?"Buzz" : i);
3}
4
Giovanni
10 Jan 2021
1function fizzBuzz(n) {
2    // Write your code here
3    for(let i = 1;  i <= n; i++) {
4        
5         if(i % 3 == 0 && i % 5 == 0) {
6            console.log('FizzBuzz')
7       }
8       else if(i % 3 == 0) {
9           console.log('Fizz')
10       } else if(i % 5 == 0) {
11            console.log('Buzz')
12       } else {
13            console.log(i)
14      }
15    }
16}
Lilya
04 Nov 2018
1for(i=0;++i<101;)console.log([i,"Fizz","Buzz","FizzBuzz"][!(i%3)+!(i%5)*2])
2
queries leading to this page
function fizzbuzz javascriptfizz 2cbuzz and fizzbuzz javascripthow to solve fizzbuzz in javascriptfizzbuzz c 2b 2b hackerrank solutionhackerrank fizzbuzz javascriptfizzbuzz hackerrank solutionjs fizz buzzfizzbuzz javascript hackerrankfizzbuzz hackerrank solution javascriptfizzbuzz program javascriptjavasscript fizzbuzzfizzbuzz hackerrankfizzbuzz function jsbasic fizzbuzz answershortest fizz buzz jsfizzbuzz hacker rank javasriptjs fizzbuzz functionfizzbuzz program in javascript hackerrank solutionfizzbuzz hackerrank javascriptfizzbuzz javascript codefunction fizzbuzzfizzbuzz loopfizz buzz hackerrank javascriptjavascript fizzbuzz solutionfizzbuzz solutionfizzbuzz hackerrank solution javafizzbuzz javascriptbasic fizzbuzz jsfizzbuzz program in hackerrank javascriptfunction fizzbuzz 28 29 7bfizzbuzz jsfizzbuzz function javascriptfizzbuzz solution javascriptfizbuzz using javascriphackerrank fizzbuzzfizzbuzz javascript 3 5print fizzbuzz in javascriptfuzzbuzz jshackerrank js fizbuzzfizz 2cbuzz and fizzbuzz javascriptjavascript fizzbuzz examplefizzbuzz that accepts a number in jsfizzbuzz js solutionfizzbuzz javascript solutionfizzbuzzfizzbuzz question javascriptfizz buzz solution jsfizzbuzz javascript hackerrank solutionfizzbuzz sample jsfizzbuzz code javascriptfizzbuzz program in javascriptshortest javascript fizzbuzzhackerrank fizzbuzz java8fizzbuzz in javascriptfizz fazz javascriptfizz buzz algorithm js solutionfizz buzz fizzbuzz javascriptjs fizzbuzzjavascript fizzbuzzfizzbuzz hackerrank solution javascript