My Javascript

Introduction to Javascript
History of Javascript?
JavaScript was invented by Brendan Eich in 1995
JavaScript was initially created to “make web pages alive”.
When JavaScript was created, it initially had another name: “LiveScript”.
But Java was very popular at that time, so it was decided that positioning a new language as a “younger brother” of Java would help.
Where Javascript executes right now?
Initially, we used JavaScript only to build apps that run inside our browsers.
Every browser has a JavaScript engine like v8, chakra that takes our JavaScript code and converts it to code that computers understand.
In 2009, Ryan Dahl came up with a brilliant idea. He took Google’s V8 engine and embedded it in a C++ program and called that Node.
Today, JavaScript is now used everywhere without depending on browser for execution. JavaScript can have different runtime environments nodejs, browser, bun, deno and every runtime environment provides different features accordingly.

Ecmascript
ECMAScript is the official name of the JavaScript standard, which writes specifications for Javascript.
ECMAScript writes Javascript standards or specifications and every browser or runtime environment must comply with those specifications to let JS works properly everywhere. That's why when new feature is announced in ECMAScript, some of the browsers do not support them because they have not implemented the specifcation yet.
Like QWERTY is a Keyboard standard, so that every keyboard manufacturer must make the keyboard following that standard. Suppose if every keyboard manufacturer starts changing the layouts according to their own , then there would be a problem. Same goes with Javascript.
The firs ECMAScript versions was abbreviated by numbers. (ES1, ES2, ES3, ES5, ES6).
From 2016, versions are named by year (ECMAScript 2016, 2017, 2018, ..., 2025).
Variables
Javascript variables are declared in 4 ways:
- using let (Modern and recommended)
{
let x = 10;
x = 20;
}
console.log(x); //x not defined error
- using const (Modern and recommended)
{
const x = 10;
x = 20; // assignment to constant error
}
console.log(x); //x not defined error
- using var (Not recommended)
{
var x = 20;
}
console.log(x);
- using nothing (Not recommended)
let and const are introduced in ecma 2015 which provides block level scope.
var and without var approach is old and make issues due to global scope, hence not recommended.
Sloppy mode vs Strict mode
The normal, non-strict mode of JavaScript is sometimes referred to as sloppy mode. This is not an official term but some developers use it.
"use strict"; is used at the top of the file or inside the first line of function. It has some additional features like:
changes converting mistakes into errors (as syntax errors or at runtime)
changes simplifying how variable references are resolved
changes simplifying
evalandargumentschanges making it easier to write "secure" JavaScript
changes anticipating future ECMAScript evolution.
Truthy and Falsy values
There are 6 values which are considered false values in JavaScript:
// Falsy Values for anything -> boolean
console.log(Boolean(NaN)) //false
console.log(Boolean(0)) //false
console.log(Boolean(undefined)) //false
console.log(Boolean(null)) //false
console.log(Boolean('')) //false
console.log(Boolean(false)) //false
//all others are true





