there is only number, no distinction between integers and floats. So far I know, JavaScript is the only language I worked in which doesn’t distinguish integer and float.
These exercises would be helpful if we used i.e. typeof in a case like situation. I also wonder what to use it for, and the answer is to check the type of value. But if we took a real world coding situation to show an example of when this would be handy it would sink in better. At least in my head.
The language makes promises. It has fashioned typeof to search up the prototype chain until it finds a parent constructor. That parent will be the type, in a way.
typeof 42 => 'number'
The parent constructor is Number(). JS must have some way to relate this to 'number' but those inner workings are not clear (to me). It may be an internal property:
type: 'number'
Bottom line, forgive the lessons and commit to due diligence at not leaving any questions unanswered to one’s satisfaction. It all traces back to the promise made by the language.
Yea, I didn’t care for how this particular exercise had a lacking of the right context to figure this out on your own. I assumed the hint was written the way it was to avoid just giving the answer, when it was in fact actually the answer