Solution: Logic
Review the solutions to the tasks from the logic challenge.
We'll cover the following...
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
xandy, 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
bigusing theletkeyword and initializes it with the value of the variablex.Lines 4–9: C ...