FizzBuzz

Run Settings
LanguageJavaScript
Language Version
Run Command
function FizzBuzz(n) { let result = []; for (let i = 1; i <= n; i++) { let str = ''; if (i % 3 === 0) { str = str + "Fizz"; } if (i % 5 === 0) { str = str + "Buzz"; } if (str.length === 0) { result.push(i); } else { result.push(str); } } return result.join('\n'); } console.log(FizzBuzz(10));
Editor Settings
Theme
Key bindings
Full width
Lines