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

General Discussion

Gary Gordon
Gary Gordon
192 Points

Getting started with programming. Question about console.log ?

Getting started with programming. Question about console.log ?

I went to http://teamtreehouse.com/library/programming/introduction-to-programming, and started with Basics. I went through Getting Started. This was fine. But when I then proceeded to Writing Your Program, the tutorial said "you'll remember that console.log is a function which will output information into our screen" .. but I don't remember (in the previous video, any mention about using "console.log". I do remember the console, but not the specific use of "console.log".

So, this type of statement is confusing to me (since I'm just trying to get started). Did I miss something? Should I be starting with some other tutorial video(s)?? Or am I in the correct place.

I also didn't see any information about how to set up a programming environment on my computer so I can locally run javascripts, etc. Was this covered somewhere else?

I'm trying to understand where to start, so I can start at the beginning and have things presented to me, in a manner that will not be confusing for a newbie.

Help?

Thanks, Gary

7 Answers

You can run javascript in your browser.

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <script>
        YOUR JAVASCRIPT HERE!!!
    </script>
</head>
<body>

</body>
</html>

Save it in file, name it as "index.html" and open in your browser.

Gary Gordon
Gary Gordon
192 Points

Anton,

While I very much appreciated your reply, my question went much deeper and more elementary than even this. It wasn't just how to add javascript to work, it had more to do with .. 1. the video training mentioning that comment of "you'll remember that console.log is a function ..." (which I stated above), and I don't remember this being said in the previous video. I also didn't see anything in the previous tutorial that discussed how and where to setup pages on my local computer in order and how to get them to run in my browser. There were just some very basic things missing and I wasn't sure if I missed any earlier video tutorials that may have covered these things. It just seemed as though from the first video "under Basics" to the second video, there was a disconnect.

The first video started everyone out as if they knew nothing. But the second video seemed to jump ahead quite a bit (from the ending of the first video) and assumed the user (me) .. knew everything that was being shown and mentioned. So .. I'm just saying .. "I don't" and feel like maybe I'm in the wrong area and need to be viewing a different video.

I was hoping someone from TeamTreeHouse could explain? Again, the first video ... "Basics" for "Programming" > "Introduction To Programming" > "Getting Started" was very good. But the jump to the second video "Writing Your Program" jumped over many things. I need help in filling in the gaps.

Can someone tell me if there are other videos I should be watching first (before I go on to "Writing Your Program" that explains more .. from a novice stand point? If not, why?

Gary

Hi Gary Gordon :)

I'm going to tag the appropriate teachers, Jim Hoskins / Jason Seifer , and see if either of them are available to help you. There will be a slight delay in getting back to you because currently our offices are closed for the holiday weekend. We'll reopen on Tuesday around 9am EST, but our Teachers periodically check up on Student's needs during closed office hours. Stay tuned!

Shoot me an email if you have any questions help@teamtreehouse.com. :)

Best,

Elizabeth Treehouse Support

Sean T. Unwin
Sean T. Unwin
28,690 Points

The first video does not explicitly mention the use of console.log. All you have to understand is that it is a function, so ignore the "You'll remember" part. While that part of the sentence is not exactly factual it's nothing to get hung up about because what the first video was doing in the console was essentially using console.log without explicitly calling it, i.e. every time you typed something in the console and got a response within the console below what you had typed, that was using console.log.

The second video is assuming that you have an editor. Any standard, bare-bones editor will do such Notepad in Windows, (not Word or WordPad, however) or TextEdit in OSX. There are many free, cross-platform editors. The majority of TeamTreehouse instructors use Sublime Text 2. There is a free trial with it, but the trial does not expire. It is recommended to purchase a licence if you really enjoy it.

If you use Firefox you can use the ScratchPad from inside the Developer Tools as an editor and save files.

Aside from the editor(s) I mentioned above, there isn't really anything else that is assumed. The second video is a natural progression to the next step in learning the topic at hand.

For your test or project files, they can be saved anywhere, although it is recommended to create a folder to store them in to help with organization.

Good luck and keep asking questions. :-)

Gary Gordon
Gary Gordon
192 Points

Sean,

Thanks.

But, even though you explain everything else quite well, you told us to use console.log, but never explained (in detail) what the words console and log are .. and what the period is between them, and why it's written as console.log . Can you explain why the line starts out with the word "console" and what the "dot" is used for (following the word "console") and what the word "log" is doing or referring to .. immediately after the dot.

For example, you didn't explain what this is "doing". Therefore, I'm confused why you didn't just write "console" or just "log" etc. And, it wasn't explain what the "dot" does between the two words.

It was just something left out and I'd like it if you could explain so I can really understand what's happening and why it's being used, what it does, etc.

Thanks, Gary

Sean T. Unwin
Sean T. Unwin
28,690 Points

I am but a humble member here at Treehouse, not an instructor. :)

Console is a JavaScript object and log is a member of that object, in this case a function. Object members are called upon using what is called 'dot-notation'. So when using console.log we are saying we want to use the function log that is inside the console object.

You can think of the dot or period separator like a drawer -- wherein the object is a cabinet or dresser. So say we want to get some socks. In JavaScript we say ClothesDresser.getSocks or in other words, we want to get a pair of socks from a drawer in the clothes dresser. Dot-notation means to access something within a container.

In simple terms console.log is a method to output messages to the console, which is essentially a display window for messages within the developer tools of a browser. It is a developer tool for debugging and testing. Before this developers would typically use the Alert statement as was shown in the first video, but this hindered the flow of debugging and testing. console.log is far less obtrusive and much easier to use as a developer because, as the name states, it keeps a log of the output instead of just a one-time alert window.

Keep experimenting have fun with coding.

Gary Gordon
Gary Gordon
192 Points

Sean,

Thanks! I would also just like to let TeamTreeHouse know (that for newbies to programming) the glossing over even information like this, can cause issues. I'm hoping that I don't run into other "glossed over" concepts and information, regardless of how trivial it may seem. The expectation that someone (who has no prior experience with any of this) would understand what "console.log" would really mean, should have been realized before they produced the video tutorial. In the same way they took the time to explain what a "string" is .. I was expecting and hoping that other core concepts and even the smallest of programming bits of information, would have been explained similarly .. for the newbie.

But again .. thanks for your explanation. It helped a lot. smile

Gary