Sometimes, I need to lean into my discomfort
Sometimes we have to work on things we are not comfortable with. For some people, it is CSS. For others, it can be working on a solution that requires a bit of math.
Most coding jobs require basic math skills; however, few require advanced math skills (calculus, trigonometry, etc.).
There are a handful of handy math methods in JavaScript that can help you get what you need to get done.
Write an answer somewhere that you can easily reference later to practice talking/writing about code:
- What is the difference between
=
,==
and===
? - What is
NaN
? - Is
NaN == NaN
true or false? Why? - Is
NaN === NaN
true or false? Why?
Using the following numbers array, find the median.
const nums = [
14, 11, 16, 15, 13, 16, 15, 17, 19, 11, 12, 14, 19, 11, 15, 17, 11, 18, 12,
17, 12, 71, 18, 15, 12,
];
Write a function clock
that takes two integers, hour
and minute
. The function should calculate the two angles in degrees between the hour hand and minute hand on a twelve-hour analog clock face.
Note that the hour hand has 'drift'. If the time is 6:30, the hour hand will be halfway through its travel between 6 and 7. If the time is 9:45, the hour hand will be three-quarters of the way between 9 and 10.
Return an "out of range" message if the input exceeds the clock's range.
Expected output:
clock(6, 00)
=> [180, 180]
clock(12, 00)
=> [360, 0]
clock(12, 15)
=> [277.5, 82.5]
clock(9, 45)
=> [22.5, 337.5]
clock(1, 59)
=> [294.5, 65.5]
clock(500, 34)
=> "out of range"