The Code
The Code is structured in three functions
GetValues
GetValues is the controller function. It pulls the user numbers from the UI and converts them to integers, if able. If the values cannot be parsed, an alert pops up to make sure only integer values are entered.
If both values entered are integers, the functions generateNumbers and displayBeji are run.
GenerateNumbers
GenerateNumbers is the logic function. It takes in the user values as start and end values. It initializes an empty array into a numbers variable.
A for loop runs that pushes each index value into the numbers array.
generateNumbers returns the numbers array.
DisplayBenji
A for loop looping through the numbers array initializes a number variable that stores the value of each numbers array element. It checks if the current element is even using an if-else statement.
If the value, evaluted using a modulus, is even, an evenDisplay class is added bolding and coloring the value printed. If the value is odd no class is added. At the end of the loop, a new tableRow is appended to the tableBody.