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 Booleans

Challenge Task 1 of 1 JavaScript Boolean Value challenge

I am getting an syntax error will working on this challenge. Please look at it and give me some pointers. I can't seem to locate the error or errors.

script.js
var randomNumber=Math.floor(Math.random()*6)+ 1;
var guess=prompt("I am thinking of a number between 1 and 6. What is it?")
if (parseInt(guess)===randomNumber{
    alert('This is true');
} else {
    alert('This is false, The number was ' + randomNumber + ');
}
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

2 Answers

Thanks to everyone that has assisted me with this new challenge of coding. It's all new to me and I really appreciate the support from the Treehouse Community. I wish you all well and thanks again for the support of learning something new. Julia

Robert Bennett
Robert Bennett
11,927 Points

Here you go - You where missing: a: ) and: a: ' I ran this on my computer.

 <script>
     var randomNumber=Math.floor(Math.random()*6)+ 1;
var guess=prompt("I am thinking of a number between 1 and 6. What is it?")
if (parseInt(guess)===randomNumber) {
    alert('This is true');
} else {
    alert('This is false, The number was ' + randomNumber + '');
}


    </script>