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 trialJason Papenmeier
Courses Plus Student 780 PointsI am curious as to why the noAlert() function does not return a value in the latter part of the code snippet.
I understand why the alert is never called in the function, and why it is called outside of the function....but I cannot figure out why calling the alert function immediately after the noAlert() function prevents the noAlert() function from returning a value.
1 Answer
Steven Parker
231,275 PointsThe noAlert function does still return a value, but the nature of the console is to display only the value returned by the last operation performed. So when the alert is executed, the previous return value is forgotten and the value it returns ("undefined") is the only thing displayed.