# How do I get rid of the numbers that are stuck to "Fizz" and "Buzz" on this FizzBuzz challenge from the book Eloquent Javascript. Only clues no full answers

How do I get rid of the numbers that are stuck to "Fizz" and "Buzz" on this FizzBuzz challenge from the book Eloquent Javascript. Only clues no full answers
0

#1

My program comes up with all the numbers from 1 to 100 with the words fizz and buzz appearing on every multiple of 3 and 5 but I’m trying to get rid of the numbers that stay glued on fizz and buzz. I don’t know what I should do next to completely get a rid of them. Here’s what I wrote

``````var emptyString = "";

for (i = 1; i < 101; i++) {

if (i % 3 === 0) {
i % 3 === 0;
emptyString += "Fizz";
} else if (i % 5 === 0) {
i % 5 === 0;
emptyString += "Buzz";
}

emptyString += i + "<br>";
}

document.getElementById("demo").innerHTML = emptyString;

``````

Here’s what comes up but obviously I’m only putting down 15 numbers for this

``````1
2
Fizz3
4
Buzz5
Fizz6
7
8
Fizz9
Buzz10
11
Fizz12
13
14
Fizz15
......
``````

The question for this challenge is page 38 - https://eloquentjavascript.net/Eloquent_JavaScript.pdf

#2

First thing.

What’s the purpose of these lines?

Finally,

You need to check if the number is both divisible by 3 and 5 and output fizzbuzz.

#3

First of all like shimphillip said I don’t see the purpose of the extra i%3 === 0; and i%5 ===0; either.

And after reading the problem from the book it tell to use the console.log instead of the html. But if you wanted to do this like you are doing.What you could do is put the empryString += 1 + “
”; inside a else statement that way if the other ones are true it won’t print that number. And you should also put `<br>` after both “Buzz” and “Fizz”

#4

I’m new to all of this and I don’t know what I was doing there but it the program still worked to a certain degree which is why I left it on thinking it was useful.

#5

I have solved the challenge everyone. I restarted completely and then took some of your guys advice. Thank-you shrimphilip and sharif15.