Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Making Decisions with Conditional Statements A Basic If Statement

lost

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

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

1 Answer

bryonlarrance
bryonlarrance
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

if(isAdmin===true)

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.