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

document.write("<p> Sorry. The number was" + randomNumber + </p>") Why is the last (+) sign before the clo

I cannot get this correct. Can someone please tell me what I am doing wrong?

script.js
var isAdmin = true;
var isStudent = false;
vas answer = prompt("You are Nicollette. true or false?")
if (answer)===true;
alert("<p>Welcome administrator</p>")
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

Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey again Nicollette,

In the code you shared, you're using vas in place or var which would cause an issue with your code.

However, this challenge is only asking you for a super simple if statement solution.

Check out this working code:

var isAdmin = true;
var isStudent = false;

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

By adding a new variable to your code, you went from checking if isAdmin was true to checking if answer was true, which was why the code challenge wouldn't allow you to pass.

I also just noticed you have paragraph tags in your "Welcome administrator" alert, which aren't necessary since alerts pop up in alert boxes and aren't actually written to the document.

Good luck with the challenge!