Skip to content

Files

Latest commit

 

History

History
24 lines (14 loc) · 569 Bytes

missing_parseint_radix.md

File metadata and controls

24 lines (14 loc) · 569 Bytes

Pattern: Use of parseInt without radix

Issue: -

Description

This rule warns about using parseInt without a radix. From the MDN developers reference: Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior.

Examples

  # You would expect this to result in 8, but
  # it might result in 0 (parsed as octal).
  parseInt '08'

  # To be safe, specify the radix argument:
  parseInt '08', 10
  

Further Reading