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 A Basic If Statement


I am literally just lost on this part. Can anyone please help explain like I'm 5? lol

var isAdmin = true;
var isStudent = false;
if (isAdmin) {
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

1 Answer

16,414 Points

So the challenge is asking you to determine if the variable isAdmin is true. We do this with a conditional statement, 'Is the variable isAdmin true. If it is then we are going to do something. In this case we are going to create an alert that says 'Welcome Administrator'

var isAdmin = true;
var isStudent = false;

if (isAdmin === true){
    alert("Welcome administrator")

The line that begins


is checking whether or not isAdmin is equal to true. If so the the next line runs. It is the alert statement "Welcome administrator". Hope that helps. Let me know if you have any questions.