parseInt() can be dangerous

Posted on
parseInt("23")          //=> 23
parseInt("023")         //=> 19 (octal)

Prevent this behavior using:

parseInt("023", 10)    //=> 23

Leave a Reply

Your email address will not be published. Required fields are marked *