Javascript Notes
Javascript Notes
JavaScript was created in May 1995 in 10 days, by Brendan Eich. Eich worked at Netscape and
implemented JavaScript for their web browser, Netscape Navigator.Initially, JavaScript’s name
changed several times:
In the Netscape Navigator 2.0 betas (September 1995), it was called LiveScript.
In Netscape Navigator 2.0 beta 3 (December 1995), it got its final name, JavaScript.
Why Javascript..?
All popular web browsers support JavaScript as they provide built-in execution
environments.
JavaScript follows the syntax and structure of the C programming language. Thus, it is a
JavaScript is a weakly typed language, where certain types are implicitly cast (depending
on the operation).
1
It is a light-weighted and interpreted language.
The original name of that organization was ECMA, an acronym for European Computer
Manufacturers Association. It was later changed to Ecma International (with "Ecma" being a
proper name, not an acronym) because the organization’s activities had expanded beyond
Europe. The initial all-caps acronym explains the spelling of ECMAScript
In principle, JavaScript and ECMAScript mean the same thing. Sometimes the following
distinction is made:
The term ECMAScript refers to the language standard and language versions. Therefore,
2
Editio Date of Name Description
n Publishe
d
5.1 June 2011 ECMAScript Another small update to keep Ecma and ISO
5.1 standards in sync
7 June 2016 ECMAScript First yearly release. The shorter release life
2016 cycle resulted in fewer new features compared
(ES2016) to the large ES6.
9 June 2018 ECMAScript New features include the spread operator and
2018 rest parameters (...) for object literals,
(ES2018) asynchronous iteration,
3
Promise.prototype.finally and additions to
RegExp.
10 June 2019 ECMAScript Added features include, but are not limited to,
2019 Array.prototype.flat, Array.prototype.flatMap,
(ES2019) changes to Array.sort and Object.fromEntries
BASIC PROGRAM
<! DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tutor Joes</title>
</head>
<body>
<script>
alert("Tutor Joes");
</script>
</body>
</html>
CONSOLE
4
The JavaScript console is a built-in object in the browser that provides access to the browser's
developer console. The developer console is a tool that allows developers to view and debug
their code, as well as run JavaScript commands directly in the browser.
In javascript, the console is an object which provides access to the browser debugging console.
We can open a console in web browser. The console object provides us with several different
methods:
log()
error()
warn()
clear()
table()
count()
5
Differences Between var, let, and const in JavaScript
var
Variable means anything that can vary. In JavaScript, a variable stores the data value that can be
changed later on.
Use the reserved keyword var to declare a variable in JavaScript.
let
let cannot be Redeclared.
let must be Declared before use.
let have Block Scope.
const
const cannot be Redeclared.
const cannot be Reassigned.
const have Block Scope.
var a=25;
console.log(a)
var a=45;
console.log(a)
let a=25;
console.log(a)
let a=45;
const a=25;
console.log(a)
const a=45;
6
Arithmetic Operations
1. + Addition
2. - Subtraction
3. * Multiplication
4. ** Exponentiation (2016)
5. / Division
6. % Modulus (Remainder)
7. ++ Increment
8. -- Decrement
Addition (+): This operator is used to add two or more numbers together. For example, 4 +
Subtraction (-): This operator is used to subtract one number from another. For example,
Multiplication (*): This operator is used to multiply two or more numbers together. For
7
Division (/): This operator is used to divide one number by another. For example, 10 / 5
Modulus (%): This operator is used to find the remainder when one number is divided by
Exponentiation (**): This operator is used to raise a number to a certain power. For