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

JavaScript JavaScript Basics (Retired) Making Decisions with Conditional Statements Review Boolean Logic

boolean values

Quiz Question 1 of 6 Please fill in the correct answer in each blank provided below.

Bummer! '=' is incorrect
Complete the code below so that both conditions must be true for the alert message to appear: if ( loggedIn === true = level === 'admin') { alert("Access granted."); }

a i am totally lost, should I type again true or false, when its already there, what character is used to connect there if not what does the question require.

Carl Evison
Carl Evison
2,656 Points

Instead of the single equal sign you should use && so that both conditions need to be true.

1 Answer

Wiktor Bednarz
Wiktor Bednarz
18,647 Points

Hey Lauren,

single equal signs are used only for declaring variables, may they be strings, objects, functions etc. So using one in your logic test is an error. What you're looking for is a logical operator && (and). It evaluates if the statements before and after it both have equal logical value.

if (loggedIn===true && level==='admin') {
 // do something
}