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