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...
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
scaleOrdinalscale and initialized it in line 4. - In line 5, we have set our domain of the
c_scaleto thecoursesarray using thedomain()function. - In line 6, the range of
c_scaleis initialized totimingsusing therange()function. - Using
console.login line 7, we can see the output of thec_scaleon the console.
Note: You can add the unknown function in the solution which will take care of the invalid inputs.