What will be the result of the following code?
 parseInt(1 / 0, 19); 
ParseInt treats its first argument as a string which means first of all Infinity.toString() is called, producing the string "Infinity". So it works the same as if you asked it to convert "Infinity" in base 19 to decimal. What happens next is that parseInt scans the input "Infinity" to find which part of it can be parsed and stops after accepting the first I (because n is not a valid digit in base 19). Therefore it behaves as if you called parseInt("I", 19), which converts to decimal 18

@xalexvp02 yeah! just a tricky question about javascript behavior

2018 Feb 4, 5:33:01 PM

far from obvious application of the base

2018 Jan 21, 8:18:50 PM

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Зареєструйся Зараз
або Підпишись на майбутні тести