Possible issue when using parseInt function.

@psynnott recently pointed out that there was a potential issue in some of the code we had written.  It involved using the parseInt function of JavaScript in order to ensure we are dealing with integer values.

He noticed that if you pass a string of '09' the function will attempt to treat the value as an octal (which is a fairly insane thing to have as a default in my opinion) in order to fix this you would change

var test = parseInt('09');


var test = parseInt('09',10);

This will force base 10 to be used instead of octal.

Recent posts View all

Simple CS


Let's learn about Compilers, what they are and how they work.


Adding an integration to a Slack room

How to add an integration to a Slack room. Part of our Slack mini series.