Avoid Using The ParseInt Function Without An Explicit Base Parameter

< 1 min read

Impact Area

Manageability

Severity

High

Affected Element

Lightning

Rule ID #

SF-0059

Impact #

The second parameter to the parseInt function specifies the base for the conversion operation. This parameter is optional and usually defaults to 10 (base/radix is 10 for a decimal number). But different implementations may behave differently, causing unwanted results. It also improves readability, if the base is given.

Remediation #

Always specify the second parameter to the parseInt function.

Time to fix #

45 min

References #

See the PMD documentation article: UseBaseWithParseInt.

Updated on March 21, 2025
Was it helpful ?