#1 — Getting Started with JavaScript

What is Javascript?

Javascript, not to be confused with Java, is a high-level, dynamically typed and interpreted programming language. I’ll explain.

Javascript is a very powerful programming language which is transforming the web. It is present on this very page, as I write this. It has allowed for wonderful user experience and interaction on what is now becoming more than just web applications. Javascript is arguably the most versatile programming language.

Being a high-level programming language simply means that it kinda very closely resembles natural human language and less closely resembles 0’s and 1’s, like this: “1010010”.

What does being a high-level programming language have to do with anything? Well, for one, it’s easier to type, read and understand because it’s closer to human language. I will show you the difference between a high-level and a low-level programming language, which in contrast, is more like 0’s and 1’s and less easier to read and understand.

mov edx, [esp+8]
cmp edx, 0
ja @f
mov eax, 0

cmp edx, 2
ja @f
mov eax, 1

push ebx
mov ebx, 1
mov ecx, 1

lea eax, [ebx+ecx]
cmp edx, 3
jbe @f
mov ebx, ecx
mov ecx, eax
dec edx
jmp @b

pop ebx

Above is a program written in a very low-level programming language called Assembly and its function is to calculate fibonacci numbers:

0, 1, 1, 2, 3, 5, 8, 13

Compare with this, written in Javascript:

var looping = function(n) {
var a = 0, b = 1, f = 1;
for(var i = 2; i <= n; i++) {
f = a + b;
a = b;
b = f;
return f;

Not only is the Javascript example shorter, it’s also easier to read and understand (That may not hold true for you absolute beginners).

If you look really closely at the Javascript example, you’ll see words like return, looping and for. These are normal English words and you can probably tell what they do by just looking at them. The same cannot be said for Assembly.

This example above isn’t meant to show that Javascript is a better programming language than Assembly, as the two are very useful and are used differently in the real world.

Assembly is used in things like compilers and it communicates real closely with the processor, so if you wanna be friends with processors, get to know Assembly. On the other hand, Javascript is more of a Web Technology guy and it’s mostly used when you are looking to build websites, web apps or things that run on a server.

Dynamically Typed?

When a programming language is said to be dynamically typed, it simply means that it gives you the freedom to put basically anything in a variable.

Think of a Javascript variable like an elastic band that can be worn over almost anything regardless of its shape.

Let’s step back a bit. I mentioned variables. Variables are simply values a computer program holds during execution. For example in our Javascript Fibonacci function, we see stuff like “a = b”, in this case “a” and “b” are both variables and they contain a certain value. In Javascript, this value can be anything or more technically, can be of any type. Some simple types of values are “boolean”, “int” and “float”.

Being dynamically typed is awesome for me. It means I can do stuff like this:

a = 5
a = 5.6
a = ["5","6"]

Some programmers may say this is a really bad thing and can cause a lot of confusion and that is true. I think it’s great if used properly.

During interpretation, the Javascript interpreter, resolves what type each variable is.

Interpreted you say?

Every program written in any programming language needs to be broken down into what is called Machine Language (Binary). Some programming languages are broken down through a process called interpretation and some through compilation and others offer both choices.

Interpretation happens directly on the code written. The interpreter, the guy doing the interpretation converts the whole program into smaller bits and executes them directly, bit by bit.

Compilation is a bit different, the program is still taken in little chunks and the compiler has to convert the whole thing to machine code or something close called bytecode before the program gets executed.

Interpreted or compiled, it doesn’t really matter these days. Most languages offer both choices. The difference between the two is the point when they are converted into machine language — 0’s and 1’s.

Both have their pros and cons and are very much in use today.

So that is my “bit” about Javascript. You can read about more programming stuff on my publication.

What do you think about this article and Javascript? Please share in the comments section below.

Thanks for reading. Consider following me on twitter @THEozmic