Truthy Values —
Falsy value —
Null vs undefined —
Double equal (==) vs Triple equal (===)
triple equals ( === ) will do the same comparison as double equals (including the special handling for NaN, -0, and +0 ) but without type conversion; if the types differ, false is returned.
=== Strict Equality Comparison (“strict equality”, “identity”, “triple equals”)
== Abstract Equality Comparison (“loose equality”, “double equals”)
map calls a provided
callbackFn function once for each element in an array, in order, and constructs a new array from the results.
callbackFn is invoked only for indexes of the array which have assigned values (including
Filter & find —
The find() method returns the first value that matches from the collection. Once it matches the value in the findings, it will not check the remaining values in the array collection. The filter() method returns the matched values in an array from the collection.
Scope determines the accessibility (visibility) of these variables.
Variables defined inside a function are not accessible (visible) from outside the function.
var value=50;//global variable
There are 3 ways to create objects.
- By object literal
- By creating instance of Object directly (using new keyword)
- By using an object constructor (using new keyword)
- By array literal
- By creating instance of Array directly (using new keyword)
- By using an Array constructor (using new keyword)
- Use var keyword to make data members private.
- Use setter methods to set the data and getter methods to get that data.