DEV Community

Cover image for Getting started with JavaScript : The Definitive Guide
Rohini Bali
Rohini Bali

Posted on

Getting started with JavaScript : The Definitive Guide

I started reading out this book a week ago and here I'm trying to break-up a few things I understood while getting started.

Chapter 01 : Introduction to JavaScript.

JavaScript is a high-level, dynamic, interpreted programming language that is well suited to Object oriented and functional programming styles with multi-paradigm. It has curly-bracket syntax, prototype-based object-orientation, and first-class functions. It is basically everywhere around us.
I know what you're thinking. Alright, I accept these are a lot of jargons to take in abruptly. So let's get our feet into the deep waters one foot at a time.

Alt Text

What is High-level Programming language?
In computer science it can be explained as a programming language that uses abstraction(providing relevant information in a type). Means we all know machine cannot understand natural languages that humans speak. They only understand the binary or machine level language, which consists of only zeroes and ones. Now what earlier software engineers did for us was they kind of made a dictionary in which they wrote down sequences of 0's and 1's so that when we type something in our natural language the machine will have a reference to look up to, to understand what it exactly means in machine level language.

Alt Text

A dynamic programming language is nothing but just a class of high level programming language in which operations otherwise done at compile-time can be done at run-time. In JavaScript it is possible to change the type of a variable or add new properties or methods to an object while the program is running. This is the ability of a dynamic language.
Interpreters run through a program line by line and execute each command so if a command in JavaScript is executed, that is done in the manner previously mentioned and thus becomes an interpreted language. The point to note here is that in compiled languages that are directly converted into machine code, they tend to be faster than interpreted languages. But with the development of JUST-IN-TIME compilation the gap is shrinking.

Alt Text

Chapter 02 : Lexical Structure.

When learning any new language one needs to keep in mind that every language in this world has a particular script and a particular set of defined rules on which the whole language relies upon. Like you know how American English has the same letters as British English but still both are different in ways. Pronunciation, spelling of particular words etc. Similarly in every programming language there is a set of elementary rules that specifies how you write programs in a particular language. This is called lexical structure or in simple words its syntax. Important points to remember are that :

  1. JavaScript is a case-sensitive language.
  2. JavaScript ignores excess whitespace along with line breaks except for those that are a part of string or regular expression literals.
  3. Currently according to ECMAScript 6 there are total of 48 reserved keywords in JavaScript.
  4. JavaScript programs are written using the Unicode character set.
  5. Semicolons are optional.
  6. Primitive types (inbuilt or predefined datatypes and methods linked to them).

We will continue to discuss the further chapters.
If you think this article can be improved do let me know. 🙂

Top comments (4)

shaijut profile image
Shaiju T • Edited

Nice, 😄, So Javascript and Pyhton being a interpreted language is slow compared to compiled languages like C, C++, C# and Java ?

Then how come Node.Js is fast, its also Javascript right ?

gnogara profile image
Guilherme Nogara

Take a look here:

Why is this NodeJS 2x faster than native C?


For the sake of a presentation at work, I wanted to compare the performance of NodeJS to C. Here is what I wrote:

Node.js (for.js):

var d = 0.0,
start = new Date().getTime();

for (var i = 0; i < 100000000; i++)
d += i >> 1;


As you can find there, compiled languages can get optimized really well as they are getting compiled. The question shows that without any optimization, they have similar results in execution time, with JS/Node getting ahead even!

But the C optimized by the compiler can shave off half it's run time, leaving JavaScript and Node in the dust.

This optimization in compile time is impossible for languages that are compiled just in time (JIT) like JavaScript/Node

So, while JS/Node are not slow per se, they can't ever be as fast as compiled languages.
shaijut profile image
Shaiju T • Edited

Topic is getting hot, Today i read this post which said JS is a compiled language but here i read JS is a interpreted language. There is lot of confusion going on this topic.

  • Stanford University teaches JS is a interpreted language.
  • Mozilla Javascript Docs is saying JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.
  • Below posts says it is compiled language


Is there single source of truth for Javascript like a official document ?

I think Mozilla statement is correct Javascript is just-in-time compiled at run time and thus not fully compiled at build time like other compiled languages.

rohinibali profile image
Rohini Bali

You should refer to MDN docs since the creators of javascript previously which introduced netscape are the in hold of Mozilla