The FizzBuzz Function
Part of the Fundamentals section of Coddy's JavaScript journey — lesson 54 of 77.
Challenge
EasyAdd a function named fizzbuzz that gets one number (int) as an argument, and:
- If the number is divisible by 3, return
"Fizz". - If the number is divisible by 7, return
"Buzz". - If the number is divisible by both 3 and 7, return
"FizzBuzz". - If none of the above conditions are met, return the number itself in a string format.
Finally print the output of fizzbuzz(num) where num is the given input.
Try it yourself
let num = parseInt(inp); // Don't change this line
// Type your code belowAll lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Type Coercion7Bill Split Calculator
Welcome MessageCalculating The Tip And Total2Variables
NumbersStringBooleanNaming ConventionsEmpty VariablesRecap - Initialize VariablesConstants3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsComparison OperatorsStrict vs Loose EqualityRecap - Simple Math6Basic IO
OutputOutput with VariablesType Conversion - Part 1Type Conversion - Part 2Recap - Till 120Recap - True or False