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

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?

var isAdmin = true;
var isStudent = false;
vas answer = prompt("You are Nicollette. true or false?")
if (answer)===true;
alert("<p>Welcome administrator</p>")
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

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!