Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
/*
  loop and count up to 100
  console.log each value
  replace any number divisible by three with the word "Fizz", 
  replace any number divisible by five with the word "Buzz".
  replace any number divisible by three and five with the word "FizzBuzz".
  
  %
  
*/
//FIZZBUZZ SOLVED
function fizzBuzz(limit) {
for (x=1; x <= limit; x++) {
    if (x % 5 === 0 && x % 3 === 0) {
      console.log("fizzbuzz");
    }
    else if (x % 3 === 0) {
      console.log("fizz");
    }
    else if (x % 5 === 0) {
      console.log("buzz");
    }
    else {
      console.log(x);
  }
  }
}
console.log(fizzBuzz(100));
//   for (x=1; x <= 100; x++) {
//     console.log(x)
    
//   }
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers