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 trialMarcell Ciszek
7,255 PointsWhy does this code always print correct even if i don't fill in the prompt?
let quiz2 = prompt('name at least one of my brothers name') if (quiz2 === 'filip' || 'hector'){ alert('correct') } else { alert('wrong!'); }
1 Answer
Magnus Hållberg
17,232 PointsIt's because the if statement is missing what to test "hector" against. It needs to be more specific, like this.
if (quiz2 === 'filip' || quiz2 === 'hector')
Then it should work.
Marcell Ciszek
7,255 PointsThank you Magnus, and tack så mycket för hjälpen!
Aurelian Spodarec
10,801 PointsAurelian Spodarec
10,801 PointsThis is a much better formating.
var = 1;
You use it without the /
/```javascript
/```