code

The code is structured in three functions:


getValues()

This function get the user inputs for fizz, buzz, and endValue, makes sure those are numbers, and passes them as parameter for the next function:


generateFizzBuzz()

This functions uses a for loop to increment from 1 to the user-specified limit. Each time a number in the range is equal to a multiple of fizz, buzz, or fizzbuzz, that value is replaced with the corresponding word. Once finished, the array is passed as a parameter to the final function:


displayFizzBuzz()

This function simply uses a for loop to assign each value in fizzBuzzArray to its own cell in the results. It also assigns different CSS classes to change the background color of the cell.