Solution: Logic
Review the solutions to the tasks from the logic challenge.
We'll cover the following...
Solution 1
Here is a possible solution for checking which number is bigger:
Explanation
Lines 1–2: Declares constant variables
x
andy
, and assigns to them the values returned by theNumber()
function applied to the results of theprompt()
function.The
prompt()
function displays a dialog box in the browser where the user can input some text.The
Number()
function then attempts to convert this input text into a numerical value.
Line 3: Declares a variable
big
using thelet
keyword and initializes it with the value of the variablex
.Lines 4–9: C ...