Skip to main content

Command Palette

Search for a command to run...

Introduction to JavaScript

Updated
•7 min read•View as Markdown

The language, the myth, the legend…!! It’s JavaScript. In modern time, JavaScript is a massive thing in programming community. It can be used almost anywhere, from webapps to desktop apps to mobile apps to machine learning. It can be used anywhere. In this article we will have the brief introduction about JavaScript.

What is JavaScript?

JavaScript is simple general purpose, high speed, cross platform, Object Oriented, light weight, high level, dynamically typed, event driven, asynchronous/non blocking, single threaded programming language with huge community support.

Well I know these are a lot of jargons, but it’s easy to understand.(And also we can add more, but i think it’s enough to intimidate a beginner and show-off my power to remember a lot of jargons.😎😂) And also take note, that because of all these attributes, JavaScript has been so popular and supported by programmers.

Don’t worry, It’s super easy to understand. So let’s learn briefly about these jargons, what they want to say,

General Purpose

General purpose language means the same as the name suggests. It’s “General“ purpose language. It can be used to solve wide variety of problems in various domains.

For example,

  • Machine learning (Tensorflow.js).

  • Web Development(ReactJS, NodeJS).

  • Software Applications (Electron.js)

  • System Programming (Built-in modules)

High Speed

The execution speed of JavaScript is high as compared to other high level programming language.

Cross Platform

JavaScript is cross platform executable language. Which means it holds the ability to be executed on different operating systems and devices.

Therefore, it is “Write once, run anywhere“ type of language.

Object Oriented

If I try to give you crux in one sentence then, Object Oriented programming is a method or can say is a style to organize your code structure.

We will learn deeply about it in upcoming series. Till then you can read this wonderful blog about what programming paradigms are and it’s type.

Light Weight

JavaScript is considered to be light weight because, it is cross platform(write once, run anywhere), automatic garbage collection built in functionality, interpreted language.

Cross platform : write once run anywhere. There we don’t have to write redundant(same thing) again for same functionality for different operating system or devices.

Automatic garbage collection : JavaScript has in built garbage collector. It’s job is to free the space occupied by unreachable objects and variables (don’t worry, if you don’t know about them, The next blog will be about it only. For now, think like something we don’t need has occupied the space, and we remove them to use the space.) during the runtime.

Interpreted : JavaScript is interpreted language. Which means, interpreter(A software which directly executes the code. And to write it in a confusing way, it’s a block of code which directly executes another block of code.😅) reads the code line by line, and executes that line of code. and then it goes to next line. Therefore it doesn’t need any extra space like compiled language.(compiled languages are languages in which compiler translate the this high level language into low level language and gives us a extra file which is machine specific and can be directly executed by the CPU. for more info, read this wonderful article.)

High Level

JavaScript is High level language because of it’s nature of human readable syntax, in built memory management, and a lot of abstraction from hardware.

Dynamically Typed

In JavaScript code, we don’t have to specify the datatype of the variable at the time of declaring it. (If you are beginner, this sentence might intimidate you a bit, but every word will be understood after you read the next blog. So you can skip this attribute, no one will know!😉)

Note : Both next attributes are a bit technical and gigantic topic in it’s own. So I will try my best to briefly explain it as simply as possible but if you are a beginner then it will take time for you to grasp that and also you will have to read more about it to have more clearer understanding about it. So go ahead read about it, and get intimidated get curious about it and then read more about it. In one of my upcoming blogs, I will explain them. Till then, I will share some articles after the subsection for you to understand them for now.

Asynchronous programming

When a task is time consuming, so we start that task, and put it on the backside and start executing the next line of code. because we don’t wait for that task to complete and immediately start execution of next line, we can say it is efficient resource utilization. JavaScript supports this functionality. And when that tasks is completed, we get that back to front side and process it. Learn more about from this wonderful blog.

Event Driven

JavaScript is event driven programming language. Event driven programming language is a method in which flow of control should continue. Event driven means, we execute a program after a certain event has occurred. I have pointed the reasons for it below.

  • Responding to events : JavaScript is used largely on websites. And when user interacts with websites like clicking the button, or mouse hover over a component or enter value in input box or submit a form, we can attach a eventListener to that component and when user interacts that way, we can executes some code to respond to that activity.

  • Event Loop : Event loop is one of the core component of JavaScript engine to execute the code. When a certain event(for example user activity) occurs, and we have attached a callback to that event, Event loop inserts that callback into the a queue which executes all the callbacks one by one.Learn more about from this wonderful blog.

  • Asynchronous programming: It processes the output of task after it completes it’s tedious work on the backside. so it is also event driven.

Single Threaded Language

Single threaded language simply means JS engine can execute one process at a time in sequential manner.

Paradox: If JavaScript is single threaded language, then how is it able to support asynchronous programming functionality. Because, even though that tedious task is running in background, that should still be considered code execution. then how JS engine is able to do more tasks simultaneously if it is single threaded language?

I have answered it briefly in previous attributes, so if you can understand it, Bravo🥳!! you have pretty good attention to details😃. And to those who didn’t understand, It’s ohkay, learning is important. And in my upcoming blogs I will explain this in very smooth manner that you won’t forget it.(If this detail makes you feel any better, then I also couldn’t understand it first few tries, I had to put a lot of effort to understand it. And now I am explaining it to you!)

Well, Finally, the introduction is over and we will deep dive into JavaScript Programming language.

Prerequisite

There are no prerequisites as such. but the important things you’ll need are listed below.

  • Laptop: Kind of mandatory😅.

  • Some Applications :

    • NodeJS : It’s JavaScript runtime(or we can say JS engine.). We will execute our JavaScript code on this platform.

    • VS Code: It’s open source code editor. It helps a lot with the developer productivity.

      Note : There are hundreds of tutorial available online for you to install these apps. Just search ”<software> + <your operating system> + installation” and voila! you got hundreds of tutorials and you can follow any of the resource.

  • Curiosity : This prerequisite holds the same importance as the listed above two. You’ll be able to learn a lot that with this single attribute. Anything you don’t understand, ask “why?“. Try to learn about. Try to understand it. Learn to be Curious about things. And in no time you will gain the amount of knowledge, you wouldn’t have imagined.

Well I hope reading this article was worth your time😁. (If not, then I have other amazing articles which might intrigue you!☺️). And it will help in your coding journey. “See you” in next blog. Till then, Happy Coding! Take Care!.

Let's learn JavaScript

Part 1 of 1

I will start with the basic concepts of JavaScript and slowly progress to the advance concepts. I will make sure that this series is entertaining enough to engage your focus, and knowledgeable enough for you to understand any JavaScript codebase.

More from this blog

Let us learn

2 posts

I will explain technologies and concepts from basic to advance. All the 6Ws questions will be explained. After reading entire series, you will be able to implement it in your own dream project.