Hi @val4o,
Nice solution for FizzBuzz
When the inner for
loop exits (at the end of each row) "\n"
adds a line break, so that the next iteration of the outer for
loop can start the new row on a new line. You can read more about it in this post.
Also, Iâm not sure if you know, but before you type in your code to post it here in the forum, click on the </> icon in the menu at the top of the text editor. That will give you 2 sets of 3 back ticksâŚ
```
```
If you now input your code between these, you will end up with it nicely formatted. You will probably still need to organise it a bit more with the correct spacing and indentation etc., but itâs much easier to do that effectively once itâs formatted than when itâs not. It also helps spot any errors, as the code is much clearer and easier to read. Your code for FizzBuzz should end up looking something like thisâŚ
for (let x = 1; x <= 100; x++) {
if (x % 3 == 0 && x % 5 == 0) {
console.log('FizzBuzz')
}
else if (x % 3 == 0) {
console.log('Fizz')
}
else if(x % 5 == 0) {
console.log('Buzz')
}
else console.log(x)
}