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) Storing and Tracking Information with Variables The Variable Challenge

jennifer ray
jennifer ray
7,875 Points

workspaces not working?

hello, I was trying out code and thought I was writing something wrong as it would not load at all on workspaces but tried it in codepen and it works great. My code is below (sorry about the story just playing) Is it something I am doing wrong? my computer? Any thoughts anyone?

var monkey = prompt('Name a bread of monkey or ape');
var toy = prompt('Name an animal toy');
var food = prompt("Name a food for monkey's");
var number = prompt('Type a number');
var end = alert('Well done, you are all done now enjoy your story');

var story = 'Hello and welcome to my monkey sanctuary. First of all we are going to visit the ' + monkey + ' the ' + monkey + ' today are playing with a ' + toy + '.' + ' Now we can go over to the chimps where they are eating ' + food + '.' + ' As you can see there are ' + number + ' monkeys.';

document.write(story);

Is linked to any HTML? It works fine when I plunk it into the Chrome console also.

Nathan Williams
seal-mask
.a{fill-rule:evenodd;}techdegree
Nathan Williams
Python Web Development Techdegree Student 6,851 Points

Hi Jennifer,

I just edited your question and your answers in order to add the code-highlighting markdown, which should help others be able to help answer your question. In the future, you can ensure any code you paste in the forum shows correctly by wrapping it in 3 back-ticks (3 back-ticks on a line before you paste, 3 back-ticks on a line after).

Cheers!

4 Answers

jennifer ray
jennifer ray
7,875 Points

yes it is link to HTML the code is:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="css/main.css">
  <title>The Story Maker</title>
 </head>
<body>
  <div class="container">
  <h1>The Story Maker</h1>
  <script src="story.js"></script>
  </div>
</body>
</html>

can you share your html?

jennifer ray
jennifer ray
7,875 Points
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="css/main.css">
  <title>The Story Maker</title>
 </head>
<body>
  <div class="container">
  <h1>The Story Maker</h1>
  <script src="story.js"></script>
  </div>
</body>
</html>
jennifer ray
jennifer ray
7,875 Points
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="css/main.css">
  <title>The Story Maker</title>
 </head>
<body>
  <div class="container">
  <h1>The Story Maker</h1>
  <script src="story.js"></script>
  </div>
</body>
</html>
jennifer ray
jennifer ray
7,875 Points

strange I copied and pasted it but its not showing it is from one of tutorials. in the div just before the closing div I typed:

<script src ="story.js"></script>