FAQ: Introduction to JavaScript - Console

This community-built FAQ covers the “Console” exercise from the lesson "Introduction to JavaScript ".

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Introduction To JavaScript

FAQs on the exercise Console

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

2 posts were split to a new topic: New to Programming, looking for tips?

A post was split to a new topic: Printing in Javascript

2 posts were split to a new topic: Is Javascript case sensitive?

3 posts were split to a new topic: Do I need to use a semicolon?

A post was split to a new topic: How to log to the console?

js is not a case sencitive language

JavaScript is a case-sensitive language. See this topic.

1 Like

I can not find the place where I actually type my answers. All I see is a black section.

You type your code in the middle of the three sections. The section on the left provides instructions for the exercise, the middle section is a code editor, and the section on the right is the console. The console is where the results of the code typed in the code editor are displayed.

Welcome to the forums!

1 Like

It will not let me type in the middle I don’t know why please help.

You can see these two links for possible solutions.

I am on a school internet connection so that could be the issue.

As I understand it: console.log writes to the console which is like a test area for seeing how JavaScript will work (or not). Document.write is an actual JavaScript object/method that when executed will write something to a webpage. Is this conceptually correct? BUT I DO HAVE ANOTHER QUESTION: when using a text editor (I downloaded ATOM), is there a way to easily copy and paste code directly from the console back to an html page that’s been opened in the ATOM text editor (between the Scripts tags). The only way I can figure out how to copy and paste from Console is to first save the console lines as a text file, then copy the individual lines from the text file back to the actual web page document. Very cumbersome. I’m pretty new here so please be nice!

When I try to add a new line to put a different code it won’t let me. (either that or I don’t know how.) Can someone tell me how to add a different line?

you mean something like this:

const example = 'hello world';

Your illustration shows nicely as I understand how you would write “example’s” output if you had typed it in console.log on a browser’s console (I use the Chrome console) and also shows the separate way you would embed code between script tags to write the “example” to web page. But my question is this : let’s say you’ve carefully worked out using the Chrome consol maybe 10 lines of code - everything is nice, no errors, ect. Now you want to copy collectively (all in one copy) those lines from the console into your web page file (which for discussion I’ve opened in ATOM), Is this possible by some simple copy and paste procedure which I can’t figure out? Same question in reverse : is there a simple way to copy and paste lines collectively together from an open html file from ATOM (I’m only interested in the JavaScript part of the file for discussion) back to console to work out errors? Thank for any continuing help - I really appreciate it!

Tested this in firefox, I could just select the code and right click → copy

I would just work in atom, make changes there, then refresh the page to reload the changes

So the console is simply the panel that displays what we are coding in real time?
Also, when we put a number in the parenthesis, console.log(28); ,does that number trigger an action? what is that action? because I only see it displayed on the console panel, I’m not sure what it’s doing. Also when I put a word in the parenthesis it shows a long red message, looks like a error message. I’m assuming you only can use numbers for .log() action to represent data about the value of something.

.log() is the action, you log to the console.

we can also log strings, objects, arrays and more.