JavaScript: Sandbox

Title placeholder

function fizzbuzz (n) { let text = ""; for (let i = 1; i <= n; i++) { if (i%3 === 0 || i%5 === 0) { if (i%3 === 0) { text += "Fizz"; } if (i%5 === 0) { text += "Buzz"; } } else { text += i; } text += " "; } console.log (text); } number = prompt("Enter a number"); fizzbuzz(number);
Code placeholder