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
Desmond Dallas
6,985 PointsHelp with Javascript
Can anyone tell me what is wrong with this code. Ive copied it to how is says on the video and still Im getting an error on line 3 (parseINt undefined.
var HTMLBadges = prompt('How many HTML badges do you have?'); var CSSBadges = prompt('How man CSS badges so you have?'); var totalBadges = parseINT(HTMLBadges) + parseINT(CSSBadges); alert('Wow! You have ' + totalBadges + ' badges!');
2 Answers
Martin Zarate
10,723 PointsJust a couple small mistakes; the name of the variable holding the HTML badges is misspelled in the concatenation, and the method to parse to integer should be parseInt(), here is the code:
var HTMLBadges = prompt('How many HTML badges do you have?');
var CSSBadges = prompt('How man CSS badges so you have?');
var totalBadges = parseInt(HTMLBadges) + parseInt(CSSBadges);
alert('Wow! You have ' + totalBadges + ' badges!');
Cheers.
Desmond Dallas
6,985 PointsGreat thanks, I just realised the errors and corrected them before the reply. Much appreciated anyway. Thumbs up