Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Foundations Numbers Parsing Numbers From Strings

Anthony Giuliano
Anthony Giuliano
9,569 Points

parseInt

Was there a change in Javascript since recording this video? When I leave out the second argument in parseInt, it seems to be defaulting to 10, which is different from what we're seeing in the video.

2 Answers

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Yes, there's been a change. According to the the ECMAScript 5 Standard, parseInt defaults to decimal, so you don't need to add a second value of 10. This is supported by all current browsers.

Anthony Giuliano
Anthony Giuliano
9,569 Points

Thanks. I was also just about to reply again because I hadn't finished watching the video where he goes on to explain that browsers can interpret it differently from each other. Good to know that the change has been made across the board though.