I know this must be very basic, but it's the first time I'm ever doing this. Here's my implementation using JavaScript, printed into an HTML element :D
<p id="target"></p>
let target = document.getElementById("target"); for(let i = 1; i <= 100; i++) { if( i % 5 == 0 && i % 3 == 0 ) { target.innerHTML += "FizzBuzz<br>"; } else if( i % 5 == 0 ) { target.innerHTML += "Fizz<br>"; } else if( i % 3 == 0) { target.innerHTML += "Buzz<br>"; } else { target.innerHTML += i + "<br>"; } }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I know this must be very basic, but it's the first time I'm ever doing this.
Here's my implementation using JavaScript, printed into an HTML element :D