Possible Duplicate:
JavaScript: why does parseInt(1/0, 19) return 18?
Why does parseInt(1/0, 19) evaluate to 18 in Javascript ? I understand 19 in not a permissible radix but still can someone tell how things are working here ?
Possible Duplicate:
JavaScript: why does parseInt(1/0, 19) return 18?
Why does parseInt(1/0, 19) evaluate to 18 in Javascript ? I understand 19 in not a permissible radix but still can someone tell how things are working here ?
Ah, quick javascript consoling led to the answer:
> 1/0
Infinity
> parseInt("Infinity", 19)
18
parseInt
seems to convert the first argument to a string, e.g.:
> parseInt(11, 2)
3
so, it's converting the string "Infinity", which explains everything.