JS is good language var body = document.body, html = document.documentElement; var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );


    
JS
var, let, const - let can not be redeclared, must be declared before use, and have block scope

When adding a number and a string, JavaScript will treat the number as a string.

const cars = ["Saab", "Volvo", "BMW"];

const person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};

get type of variable using typeof

template literal and variable substitution - Welcome ${fn,}, ${ln,}; Automatic replacing of variables with real values is called string interpolation.

Data types - (123).toString();

Ways of creating objects

string methods - concat, trim, padStart, padEnd,charAt, split, startsWith, slice, substring, length, replace, toLowerCase, toUpperCase, endsWith, indexOf

Array methods -

Date

Regular exp

scope (block, function, global), hoisting, stric mode. ES6 added block scope. Variables declared with the var keyword can NOT have block scope. Strict mode does not allow you to use variables if they are not declared

this and arrow function

Object oriented concepts - classes

new features - let, const,

Closures - Nested functions have access to variables declared in their outer scope. A closure is the combination of a function and the lexical environment within which that function was declared. Private methods can be emulated using closures

function makeFunc() {
  var name = 'Mozilla';
  function displayName() {
    alert(name);
  }
  return displayName;
}

var myFunc = makeFunc();
myFunc();
prototypes - is like a blueprint. Every object has a prototype. Object.create(object1) will create an object based upon the prototype of object1. So all the properties of object1 will be available for new object.

== vs === (=== checks if the type of variables is also same) In case of objects, it returns true only if 2 variables refer to same object Objects can be compared in shallow or deep way

event bubbling and capturing phases - stop propogation and prevent default

call, apply and bind call allows you to call a third party method on your object. A object is not able to call any mothod on its own. But call keyword allows you to do so. Apply is same as call only difference being arguments are passed in the form of array. In case of bind, method does not get executed but the reference to the method is returned.

var car = { 
    registrationNumber: "GA12345",
    brand: "Toyota"
}

function displayDetails(ownerName) {
    console.log(ownerName + ", this is your car: " + this.registrationNumber + " " + this.brand);
}
//displayDetails.bind(car, "Vivian")()
//displayDetails.call(car, "Vivian")
//displayDetails.apply(car, ["Vivian"])
set, map, weakset and weakmap Object in WeakSet can be garbage collected if there is no other reference to it.
NodeJs

Ad