I think parseInt radix should be optional · Issue #3230 · google/closure-compiler (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@jimmywarting

Description

@jimmywarting

I understand why this is. But if feels like a very old legacy issue...

/**
* Parse an integer. Use of `parseInt` without `base` is strictly
* banned in Google. If you really want to parse octal or hex based on the
* leader, then pass `undefined` as the base.
*
* @param {*} num
* @param {number|undefined} base
* @return {number}
* @nosideeffects
* @see http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/parseInt
*/
function parseInt(num, base) {}

Nowdays all browser use radix 10 as default and has done so for a long time. And the likelihood of someone starting the number with 0 and using IE8 is very slim. Many have stop supporting old browsers