Why is it recommended to provide optional radix parameter to parseInt()?

Viewed 1735

I've always used the parseInt() function in Javascript without passing the radix parameter. As per the MDN documentation here, it's stated that not providing this parameter may result in unpredictable behaviour.

Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.

Could somebody clarify what does this unpredictable behavior mean with some code examples?

3 Answers
Related