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 trialKirt Perez
7,374 PointsCan someone elaborate 5:50?
I get that when you call the function, it will return 5 and skip the alert. But he called the function again with an alert below it. Wouldn't it still return 5 and then show the alert thats not inside the function?
1 Answer
Cameron Childres
11,820 PointsHey Kirt,
The noAlert() function still returns 5, it just isn't visible in the console -- when you enter multiple statements in to the console at once it will only display the result of the final statement. You could verify that 5 is still returned by using console.log() like this:
function noAlert() {
return 5;
alert("This won't appear");
}
console.log(noAlert());
alert("This will appear");