DEV Community

Ayobami Ogundiran
Ayobami Ogundiran

Posted on • Updated on

Getting Started with Javascript.

A lot of beginners think they have to download JavaScript before they can work with it and I am like "Stop there! Do you really mean how to download JavaScript?".

No way!

If you an experienced JavaScript developer, you are probably laughing right now?

Anyway, if you are just getting started with JavaScript and you think you have to download JavaScript to run it on your computer, no, you can't download JavaScript because JavaScript comes with any browser you have on your phone or computer.

There are several browsers such as Google Chrome, Mozilla Firefox, Safari, Operamini and others.

In this lesson, we are going to use Google Chrome or Mozilla Firefox depending on your choice.

So,

  • launch Google Chrome on your computer (Or download & install Chrome if you don't have it).

  • press ctrl + N to open a new window.

  • press ctrl + shift + J (if you are using Windows) or command + option + J (if you are using macOS).

Viola, you are now in the console!

Stop there! I am using a Mozilla Firefox browser.

Oh! Don't panic. I got you covered.

  • launch the Mozilla Firefox browser on your computer.

  • press ctrl + N to open a new window.

  • press ctrl + shift + k (if you are on Windows) or command + option + K (if you are on macOS).

Yeah! You are now on the console.

It is time to show the world you are now becoming a software developer, so let's quickly write some basic code.

Let's type alert('Hello World! I am now a JavaScript developer') in the console and then press enter.

Boom!

Do you see what just happened?

It alerts the text in the browser.

Let's type confirm('Are your a developer?') and press enter.

Boom!

We now have an alert box asking you to confirm whether you are a developer or not and once you press ok, it shows true in the console but when you press cancel, it shows false in the console.

Let's enter prompt('Who am I');

Then type whatever you like in the alert box. For me, I type 'I am a coding Naija ninja'.

Let's enter console.log("I am a developer!").

Do you see that?

Others functions appeared in the browser but this one appears in the console and it is what you would probably use when you are programming with JavaScript.

Hey, Stop teaching non-sense!

What is the point of this alert, confirm and yeah, yeah, yeah, yeah?

Years ago, you were taught in basic school that a computer is a machine that takes data, processes data to give output.

I am glad to tell you - that is not a waste.

Any reasonable computation always involves:

  • collection of data
  • processing of data
  • And giving of output

How is that related to JavaScript?

Do you understand what you did when you used alert() and others in the console?

Let me explain.

In this alert('I am Ogundiran Ayobami'),

'I am Ogundiran Ayobami' is an input passed to alert() and alert() is a body of process that gives an output in the browser.

To verify this, run:

    alert('I am a software developer and I don\'t give up easily');
Enter fullscreen mode Exit fullscreen mode

Now, think about it:

'I am a software developer and I don\'t give up easily' is the input.

alert() is the processor that processes the input and
the output is the pop-up in the browser.

Once again, a computer is a machine that takes data, processes data to give output.

What a computer does is computing and I am just teaching you what and how to compute with JavaScript.

Also, alert(), confirm(), prompt() and console.log() are in-built functions in JavaScript and you will use console.log() a lot while you are programming to see the value of a variable, to check whether the code is working or getting to a certain point.

You will get to learn how to use them in the real world. Just stay connected with me.

Hey, wait! One more thing!

No real programmer uses the browser console for the actual coding. We mostly use it for debugging. So, how can you start writing code like a real programmer?

That is what we're going to deal with in the next lesson.

In the next lesson, we are going to set up a basic working environment for JavaScript.

See you in the next lesson.

Subscribe to my news-letter to always get my tutorials in your inbox: You Too Can Code

Discussion (0)