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 Basics (Retired) Working With Numbers Review Numbers and the Math Object

What will appear in the JavaScript console after this code runs? console.log( parseInt( '.5 FTE' ));

What will appear in the JavaScript console after this code runs? console.log( parseInt( '.5 FTE' ));

2 Answers

Gary Calhoun
Gary Calhoun
10,317 Points

Hi you can test that out yourself in google chrome ctrl+shift+j will open then console type it in and press enter to get your answer.

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hi Brigitt, That code will return NaN. Why? It is because of the parseInt() method being called on ".5 FTE." The method looks at its argument and because there is a mix of numbers, symbols, and letter, it will look only at the first character. In this example, the first character is a period and therefore not a number (NaN).

Hope that makes sense. Keep Coding! :)