Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Nathan Marshall
6,019 PointsWhy is undefined showing?
I have given my best shot towards the quiz challenge ( part 1 ) . I am nearly there. I just have one problem.
When I print out the correct and incorrect answers there's an undefined value which gets printed as well? I'm not sure what it is or how to get rid of it.
help would be appreciated.
Thanks
Here is my CodePen link: https://codepen.io/Nathan-Callum-Marshall/pen/zaKaaq?editors=0110
1 Answer

Steven Parker
220,913 PointsI'm not able to replicate your issue either, perhaps you've already fixed it? But you also may have been testing a function in the console, where the return code is always displayed after the function runs. If the function is not designed to return a value, you will always see "undefined" as the last output.
Also, London is not the capital of a city (it is a city). And clouds aren't actually white, but they often appear to be because of the way water droplets scatter light.

Charlie Harcourt
8,045 PointsVery interesting, Steven! So if clouds aren't white then what are they?
:D

Steven Parker
220,913 PointsNot transparent like standing water, the tiny droplets scatter light like little prisms.
Here's a more complete explanation on the Weather Channel website.

Charlie Harcourt
8,045 PointsWell I never knew that! That's very interesting!! :)

Nathan Marshall
6,019 PointsYeah, I managed to fix it :D.In the end, I just sent the questions to two arrays, one for correct answers and one for incorrect. aha apologies for the questions they make no sense my brain was going so fast
Charlie Harcourt
8,045 PointsCharlie Harcourt
8,045 PointsHi
Have you fixed the issue as I am not getting this undefined error?
Further, the first question is a little confusing. 'London is the capital of which city?' as London is a city and the capital of England but not the capital of the United Kingdom as the UK consists of several countries i.e England (Capital London) , Scotland (Capital Glasgow) , northern Ireland (Capital Belfast) and Wales (Capital Cardiff). Also, I wasn't sure what NBA star you were talking about but guessed it would be lebron James :D !!
I am struggling to find the error so maybe try running it again? Having said this the code you have wrote is very good!
:)