Solution Review: Make a Scale
This review provides a detailed explanation of the solution to the "Make a Scale" challenge.
We'll cover the following
Solution
Explanation
Let’s dive into the following explanation to better understand how the above code works.
- The most important part of this coding challenge is the selection of the correct scale. Both the input and output are discrete, so we have selected the
scaleOrdinal
scale and initialized it in line 3. - In line 4, we have set our domain of the
c_scale
to thecourses
array using thedomain()
function. - In line 5, the range of
c_scale
is initialized totimings
using therange()
function. - Using
console.log
in line 6, we can see the output of thec_scale
on the console.
Note: You can add the unknown function in the solution which will take care of the invalid inputs.