JavaScript Introduction

Hi All,

I just finished the JavaScript introduction and I can think of one thing… What??

I went through it completely lost. I understand the mechanics of what to do in console.log, but what am I doing and why? What is logging/printing the information and what is this for? Where is this information going. Any info for a beginner would be much appreciated.

From what I understand console.log() throughout the whole course is a tool to let you peek behind the curtain so to speak.

Code like:
let myVariable = 2 + 2;

already does work in JS, but how would you know it works?
Simply running a JavaScript with a code like that will not provide any feedback to the learner whatsoever. To get some sort of visual feedback, however, console.log() is used. It’s showing you results of what the code has been doing. Maybe think of it as a “preview” of the outcome of your code :slight_smile:

2 Likes

Very nice explanation! And you can see the console in most browsers (Chrome, Firefox) by pressing F12 then click “Console” at the top. See https://www.google.com/search?q=text+adventure&oq=text+adventure and open the console :wink: .

1 Like

JavaScript has me really confused. Do you guys recommend any other resources to try and get an understanding of what I’m doing and why. I’m really not understanding this one.

What we are learning here are just the basics of JavaScript , mainly coding small snippets or functions to familiarize us to its syntax and programming concepts. In the real world JavaScript is used to create web applications, games…etc. You might want to look into MEAN development, full stack programming/backend programming to see how JavaScript is used in real world situations. Also look into front end developer. These are the types of jobs that commonly use JavaScript.

1 Like

Think of it as a language actually, this helped me.

Example:
Imagine all of your knowledge has been wiped from your brain.
Now imagine you feel hungry.

You don’t know a word for that feeling, though - yet!

Imagine trying to communicate that hunger with other ppl (who also have no knowledge left in their brains). Take it one step further, imagine everyone trying to communicate hunger in their own way…

That could be confusing.

To make things easier for the blank minds let’s assume they all agree upon a word to represent that feeling of hunger: ‘hunger’. How would you call that “agreeing upon” in JavaScript (or any other similar programming language)?

JS let’s you define variables, which is basically the same thing as agreeing upon words to use. But in scope of the code itself. There are naming conventions but every programmer can call variables like whatever floats to mind or seems useful - so every program is like a whole new world of “blank minds” who agreed upon their own words to use for things that are the same for many programs if you look closely enough.

Just like the feeling of hunger that has different names in different languages, the meaning however is very alike. You will see the syntax might be different in many other programming languages similar to JS, but the “feelings” and “things” are very similar between them, too.

For programming, things that you will commonly see are:

  • variables (think of letters here)
  • functions (think of words with a meaning)
  • arrays (think of a collection of things like variables, functions, arrays, etc.)
  • objects (think of a definition of a real life object like: color, size, weight, etc. that’s what goes into the object code)
  • conditional statements (what to do if A or B or nothing at all happens, think of a guide for a task like making coffee)

… just to name a few, there’s much more for you to discover.

Once it “clicks” you will see many parallels to how things in the real world actually work. :slight_smile:

1 Like