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 trialMatthew Hemphill
1,082 Pointsstring creation with document.write problem
I'm on the Javascript basics track and it's asking me to use the document.write () function to print the contents of the player variable. I've looked through the videos and tried a number of things but I can't seem to get the right answer.
What am I missing.
var player ="Jasmine";
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="app.js"></script>
document.write("Jasmine");
</body>
</html>
1 Answer
Steven Parker
231,269 PointsYou just need to call the function and pass the variable to it by placing it in the parentheses:
document.write(player);
You'll still need the assignment you did for task 1, just add this after it.
Matthew Hemphill
1,082 PointsMatthew Hemphill
1,082 PointsAaaand that did it. Putting it in app.js and not overthinking it was what I needed. Thanks, Steven. I think several hours of staring at these lessons is my max. At least for now. My brain is goop.
Steven Parker
231,269 PointsSteven Parker
231,269 PointsGlad I could help. Perhaps after a bit of rest you'll find things go smoother.
Happy coding!