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
Dean Pierrot
18,403 PointsWill not run the "else" part of the code!
var answer = prompt('What programming language is the name of a gem?'); if ( answer === 'Ruby' ) { document.write("<p>That's right!</p>"); } else { document.write("<p>Sorry, that's wrong.</p>"); }
3 Answers
Dean Pierrot
18,403 Pointsi was doing it on workspaces. If the answer was true i got the alert i was right but once i enter a false statement, nothing happen. No alert.
Fernando Boza
25,384 Pointsperhaps it wasn't your code but your browser cache, deleting cookies or doing a cache refresh, or even try copy and pasting it on the browser console, it's what I did.
But either way your code works from what i've seen.
Dean Pierrot
18,403 PointsCool thanks Fernando!
Fernando Boza
25,384 PointsFernando Boza
25,384 PointsHi Dean it worked on my part, were you doing it on your local computer or via workspaces?