Equation Solver


x + 5 = y


Challenge 1

Get a random number by calling the randomNumber function and store it in a variable.

Display the random number in the #num1 field, where you currently see x.

Every time you refresh the page, a new number should appear.

Challenge 2

Repeat challenge 1, but this time update the #num2 field, where you currently see 5.

#num1 and #num2 should be different numbers unless they randomly happen to be the same (rare!)

Challenge 3

Calculate the sum of the two numbers and display them in #answer field, where you currently see y.

Challenge 4

Call the randomOperator function and store the returned value in a variable.

Update the #operator field to show the new operator

Challenge 5

Call the solve function and and pass it the values of num1, num2, and the operator to get the answer. Update the displayed answer.


Bonus Challenge 1

Update the randomOperator and solve functions in lib/helper.js to use "plus", "minus", "times", and "divided by" instead of +, -, *, /.

Bonus Challenge 2

Add "modulo" or % to the list of operators. Limit the possible values of num2 to 0 through 10 by passing min and max parameters when you call randomNumber