Part 1 | A Piece of JavaScript Cake Series

Can Berk OCALIR
Code Tricks
Published in
5 min readSep 5, 2022

A Beginner’s Guide | What is Javascript? Why it is powerful?

Javascript is a piece of cake series

Introduction
Hello everybody. Welcome to the most basic and easy-to-understand Javascript article series, without spending time with intentionally complex crafted examples and as easy as bread crumbles with tiny step-by-step lecturing.
I hope this series will be a cure for those having hard times understanding even the most basic concepts of Javascript.

What is JavaScript? and Why do we need it?
Javascript is a dynamically written, high-level, interpreter-based, and powerful programming, or for some people, a scripting language. It’s used for adding functionality to web and mobile apps to create more dynamic applications. So, let’s go over the basic terms which I mentioned above.

Programming Language Synthax

A Dynamic Language
First of all, what is a dynamically written language? Are there any other dynamic languages out there?
Of course, yes! As a just started or an experienced developer I can hear you are saying “Python” which is most known. Ok, but what is the relevancy?

We love Python as much as Javascript

Let’s see a basic example;
While declaring a variable in other programming languages like Java, C, C++, Go, etc., you have to give variables a type before compiling, because the compiler checks types during compiling process. These types of languages are known as compiler-based static languages.

For example in Java:

String exampleVar = “Hello”;

In the above example, we declared a variable “exampleVar” which is a String type and only holds string values inside it.

If we declared the variable as the following:

String exampleVar = 29;

The compiler would have given a type error and stopped compiling. Because we were told that our variable would only hold string values and if we needed to hold an Integer value we must:

Int exampleVar = 29;

So, lastly what is the case in Javascript as a dynamically written language? We can use var, const, let to declare a variable in JS. In Modern JS there is only const and let and they can hold any type of data inside them.

const PI = 3.14;

or

let exampleVar = “Hello”

You can also reassign a value to “exampleVar” whatever type you want without any type declaration. You can not reassign the value of “PI” because it's a constant variable. As it’s a dynamic language we can use a single variable for multiple tasks by assigning various types of values.

Low-Level and High-Level Languages
In today’s world computers are still relatively stupid and a human being must give strict directions to achieve a goal.
High-level languages are very close to human readable languages and easily understandable programming languages. The most known examples are JavaScript, Python, Ruby, etc.
On the other hand, there are low-level languages(C, C++, etc.) which are the closest languages to machine language, and because of that computers process them faster and are used wherever we need performance such as in software and games, etc.

Interpreter and Compiler
Generally, they are very similar but there are some important differences between interpreter and compiler.
The source code is human-readable code written by us and can be interpreted by a computer to machine language. Whether we use an interpreter or compiler, the final step is the binary code that the machine can understand.
Compilers scan the entire program code before giving any errors or running the program. It can be slow during the compiling process but they are faster once it's compiled. Compiler-based languages need a build step before giving a result but they are preferred for CPU and Memory management because they gave control over hardware aspects.
The interpreter also checks the program but, translates it to machine language statement by statement. Because of that it’s faster in the interpreting process and gives a result in a short time. But, interpreter-based languages are not relatively performance efficient as there is one extra step to becoming machine language.
In conclusion, compiler-based languages are the closest to machine language and are used in performance needs that may be changed soon.

JavaScript

Why is JavaScript powerful?
Once Javascript was only a client-side language that gave functionality to web pages and it stayed the same for a long time. But last decade it become very powerful because, it started to use as a server-side language (Node.JS) and is also used in various desktop applications with Electron.js, with native framework and libraries it can be used in Native Mobile Applications and of course it’s the primary language of most popular React and React Native Frameworks, Angular, Vue, Svelte, etc.
There are also 3D JS frameworks such as Three.JS and Pixi.JS and we can create games with Javascript in the recent world.
In the next decade, JS will be a popular language in Blockchain Development and VR Applications. It becomes more and more powerful as time goes on.
In the next article, we will start with Modern Javascript Principles and Variables.
See you at the next one.

Click here to go to Part 2

--

--

Can Berk OCALIR
Code Tricks

Enthusiastic developer and BA designer to learn new technologies everyday continues his journey with full-stack development. Natural leader and instructor.