This part is worth 10 points (half point per requirement). Your JS file must include:
snowInches
with value 5skiArea
with properties name
(choose your favorite),
base
set to 19, and 3 functions:isOpen
returns true if the base is greater or equal 24,
false otherwise.openSoon
returns true if base + snowInches is greater or equal
24, false otherwise.openTomorrow
has one parameter named snowInches
.
It also returns true if base + snowInches is greater or equal
24, false otherwise.isOpen
isOpen
(note: without (), this should
show the code. This happens because functions are first class in JS!).snowInches
openSoon
openTomorrow
backCountry
that is a function that:vertical
avalancheChance
to 50 - WITHOUT
using var
. NOTE: it's best practice to use var
,
the point of this is to see what happens if you forgetvar
) a variable named vertical
with a value of 800. Self test: is this a local or global var?vertical
snowInches
to 20avalancheChance
. Put a comment in your
code to explain the issue.avalancheChance
.snowInches
There's no creative programming in this exercise, but be sure you understand scope and hoisting and have some idea of first-class functions (we'll do more with this concept later).
Parts I and II will be submitted together.