JavaScript JavaScript Basics (Retired) Introducing JavaScript Using the Console

At the end of this script after the document.write(), type the code required to print 'End program' to the browser's

This is what everyone else answered as I did.

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script>
  console.log('Begin program');
document.write("Welcome to JavaScript Basics");
 console.log("End program" + "End program" ):
</script>
</body>
</html>

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great, but you have a syntax error and you're printing out what they are asking for not once... but twice.

You have typed:

 console.log("End program" + "End program" ):

This code contains a colon at the end of the statement instead of a semicolon which is producing an error. But assuming for a moment that it had been a semicolon, your code would print out "End programEnd program" to the console.

The line you're looking for is:

 console.log("End program");

Hope this helps! :sparkles:

Rhys Kearns
Rhys Kearns
4,975 Points

You are always too fast to respond! Can't keep up ;D

My code editor I've discovered are looking between atom, workspaces, sublime and etc. due to taking Treehouse course one after another on a Mac. The Safari, Google and Firefox will lock and sync on Apple's desktop when using big learning softwares like Lynda, Treehouse, Plurasjght, etc. The admin's are becoming of this issue.

Thanks Jennifer. But the prior question was misleading in that "print" and print to console is two different things. How or why would you end a program via console log command when it's purpose is to print to screen of the program. Very contradictory, but THANKS!!

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

anthony cummings To be clear, this challenge is checking if you can do it. But above and beyond that, console.log is used very often for debugging and testing purposes. Also, both of the steps of this challenge explicitly say to use the console:

print 'Begin program' to the browser's JavaScript console.

print 'End program' to the browser's JavaScript console

Given that there is only one way to print to the console, I fail to see how it is misleading. But that is just my opinion :sparkles: