First, a quick poll:
How far along in the beta curriculum are you as of April 14, 2018?
- Have not started yet
- Completed ES6
- Completed Basic Regular Expressions
- Completed Basic Debugging
- Completed Basic Basic Data Structures
Observation about Radix (
radix, so I did a little more research so I can fully understand the
According to MDN’s parseInt() page, one should always specify a radix, usually
An integer between
36 that represents the radix (the base in mathematical numeral systems) of the above mentioned string. Specify
10 for the decimal numeral system commonly used by humans. Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified, usually defaulting the value to
radix and why would we want to use anything other than
According to Wikipedia’s Radix entry:
In mathematical numeral systems, the radix or base is the number of unique digits, including zero, used to represent numbers in a positional numeral system. For example, for the decimal system (the most common system in use today) the radix is ten, because it uses the ten digits from 0 through 9.
Turns out, according to Wikipedia’s Radix entry’s “In numeral systems” section, most of us in web development are familiar with the hexadecimal system (radix number 16). Most of us are also used to using other systems in some form, like the binary numeral system or base two (radix number 2) because computers are based on this (ones and zeros) and the sexagesimal system (radix number 60) when we look at our clocks or navigate on a map.
parseInt and radix are nice to know since as web developers, we may need to convert times, navigation coordinates, or colors from hex to rgb (
parseInt("FF", 16) \\ 255). We may also want to enable users to enter numbers as strings, like
one month for example, to make our inputs more user friendly and natural. Then, we can convert that
parseInt("one", 10) \\ 1 so we can do more things with it in our code.