Skip to content

01 Basics

Biswajit Sundara edited this page May 1, 2023 · 2 revisions

What is Java Script

JavaScript is the light weight and cross platform scripting language for the Web development.

  • This is also used in developing automation scripts and interacting with DOM.

How does it run

Every browser has a JS Engine by default that helps executing the Java Script codes.

  • Internet Explorer has Chakra
  • Firefox has Spider Monkey
  • Chrome has V8

Node.Js

Before we could only run Java script in browsers.

  • Node.Js enables us to run the java script code in our machine.
  • So we can say Node.js is a Runtime environment that executes Java Script outside of a browser.
  • Node.Js is built on top of google chrome's JS engine V8.

Features

  • JS is client side as well as server side language.
  • JS is light weight and interpreted language, means the code runs as it is and we don't have to transform the code before running.
  • JS is dynamically typed. Let's say we have a variable that holds a number, later we can assign it a string.
  • Function as first class object

Installation

  • Install Node.js
  • Install Visual Sudio Code IDE

Execution

To run the java script files use command node filename.js

Comments

  • Single line comments - //this is a comment
  • Multi line comments - /* multi line comment */

Statement Closure

  • Java script statements should end with a semicolon (;)
  • If we miss to add it, then the compiler adds it by itself
  • However some times it will cause issues
  • so its always a best practice to close each and every statements using semicolon at the end.

ES6

Ecma Script is the organization that standardizes Java Script.

  • On 2015 it released a new version with lot of good features, that is called ES6.

  • Earlier version was ES5. Below are the features in ES6 which were not available in ES5

    • The let keyword
    • The const keyword
    • JavaScript Arrow Functions
    • JavaScript For/of
    • JavaScript Classes
    • JavaScript Promises
    • JavaScript Symbol
    • Default Parameters
    • Function Rest Parameter
    • Map & Set collections
    • Array.find()
    • Array.findIndex()
    • New Number Properties
    • New Number Methods
    • New Global Methods
    • JavaScript Modules

Clone this wiki locally