0% found this document useful (0 votes)
45 views

HTML

The document provides an overview of HTML tags, including the Html, Head, Title, Body, and Meta tags, along with their purposes. It also explains JavaScript variable declarations using var, let, and const, highlighting their scopes and hoisting behavior. Additionally, it covers various types of operators, tokens, and functions in JavaScript.

Uploaded by

Anirudh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

HTML

The document provides an overview of HTML tags, including the Html, Head, Title, Body, and Meta tags, along with their purposes. It also explains JavaScript variable declarations using var, let, and const, highlighting their scopes and hoisting behavior. Additionally, it covers various types of operators, tokens, and functions in JavaScript.

Uploaded by

Anirudh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

HTML

1. Html Tag
 Html tag is the root element of the container
 It is a container tag / pair tag

2. Head Tag
 It is a container tag
 The content we want to display should not be written in
head tag
 The meta data of our website we have to write within head
tag
 Inside head tag we have tittle tag

3. Tittle Tag
 It is a container tag
 The tittle of our web page we have to write within tittle tag
 This title should be displayed on browser tab

4. Body Tag
 It is a container tag
 The content we want to display should be written inside
body tag

5. Meta Tag
 Meta tags are unpair tags / Non -container tag
 It is used to store additional information of our website

Website --- Saketbhatnagar.in


ELEMENTS
Type of Elements
1. Block level Element
2. Inline level Element

Block level Element


 Always take full width of the parent container
 We can set height and width
 Example – <div> , <h1>

Inline level Element


 Occupy space required by Content
 We can not set height and width
 Example – <span> , <img>

Java runtime environment


1 browser (Live)
2 Node Js (Server side)

Java /
JS
C , C+
+
Assem
bly
Binary
Tokens
24/7/2024

 It is smallest unit of programming language


 Ex – Const a = 10 ;
Const – keyword
A - Identifier
= - Operator
10 - Literal
; - punctuators

Types of Tokens
1. Keyword
2. Identifier
3. Operator
4. Literals
5. Punctuators

Keywords
 Keywords are predefined words that is used to perform some
specific task
 It is always written in lower case letters
 If, Else , while , For , do ,switch , continue , break , function ,
Try – catch , throw ,this
 Var , let , const , function

1.Var (Awara)
 Multiple times declaration
 Multiple time initialization
 Var is global scoped

Var gf = “Naina”;
Var gf = “Sunaina”;
Var gf = “Muskan”;
gf = “Ruchi;
2.Let(Pagal)

 One time declaration


 Multiple time initialization
 let is blocked scoped and local scoped

let gf = “Khushi”
let gf = “Anjali” ---- Error
gf = “Anjali”;

3.Const(Deewana)
 One time declaration
 One time initialization
 Const is blocked scoped and local scoped

Const gf = “Angel Priya”;


Const gf = “Sonam gupta; --- Error
gf = “Monika” -- Error

Var, Let , Const


25/7/2024

var
 Variable declared with var goes to global scope
 Multiple times declaration is possible
 Multiple Times initialization is possible

 We can declare variable without initialization


Ex –

 Variable can be declared with var can be hoisted


 Variable declared with var does not belongs to temporal
dead zone

 Variable declared inside block , will go to global scope

Ex-

Let
 Variable declared with Let is blocked scope
 One time declaration
 Multiple times initialization

 We can declare variable without initilization

 We can declare variable using let without initialization. But


js engine will keep that memory block uninitialized (empty)
untill js engine reads declaration statement in execution
phase.
 Because let variable is uninitialized (empty) in variable
phase , it belongs to Temporal Dead Zone.
 The variable declared using let does not belongs to global
scope , we cannot access them with the help of window
variable.
 The variable declared using let is hoisted and belongs to
temporal deadzone. Therefore it cannot be used before
initialization (because at that moment it is uninitialized -
TDZ) .
 Variable declared inside function will be accessible inside
function only.

Const
 Variable declared with const is block scope.
 One time Declaration
 One time Initialization

 We can not declare const without initialization.


 The variable declared using const is hoisted and belongs to
temporal deadzone. Therefore it cannot be used before
initialization (because at that moment it is uninitialized -
TDZ) .
 6. The variable declared using const inside block ,does not
belongs to global scope we cannot use them with the help
of window.
 7. Variable declared inside function will be accessible inside
function only.
Operators

1. Arithmetic operators

Additon(+)
Subtraction(-)
/
*
**
%

2. Assignment Operator

Let user = “Amit”;

3. Compound Operator

(Arithmetic Operator+ Assignment Operator)

4. Relational Operator
<
>
<=
>=
== (Loose Equality)
=== type conversion
!= (Loose not Equality)
!== (first check the data type)
5. Logical Operator – Boolean Result

Logical AND (&&)


Logical OR ( | | )

6. Ternary Operator
7. let age = 18;
8.
9. let Result = age >=18 ? "You can drive the car" : "you cannot drive the car";
10.
11. console.log(Result)

Global Execution Context


Variable phase Execution Phase

Global scope
1 a=1
a : undefined 2 b=2
3 c=3
d : undefined

Block Scope
b: uninitialized
c: uninitialized

Block
VP EP
b: uninitialized a = 10
b = 20

c: uninitialized c = 30
d = 40

C.log(a)
C.log(a)
C.log(a)
C.log(a)
}

 let store undefined in execution phase


 var store undefined in variable phase

12/8/2024

1. Hoisting
 The ability of js engine to access a variable before its
declaration statement

 var let and const can’t be hoisted

 ex –

console.log(a)
var a = 1;

2. Temporal Dead Zone

 It is the time frame between variable declration and


variable
initialization in this frame we cannot access a variable .

 variable declared with let const belongs to temporal


dead zone

 example

console.log(a)
let a = 1;

Question
console.log("Start")

let a = 10;
{
console.log (a)
let a = 10
}

console.log(a)
console.log(b)
console.log("end")

Variable phase Execution Phase

1. Console.log(“started”)
Global scope 2. a = 10;
3. {
4. }

Block Scope
a : uniatialized -10

Block

VP EP

a : __________ 1. Console.log(a)  Error


2. a = 10

 You will get Error because of Temporal


Deadzone

Call stack

Block
Global

20/8/2024

ToNumber(a)
Number - Number
Symbol - TypeError
BigInt - TypeError
Null - +0
False - +0
true - 1
string - StringToNumber
Undefined  Nan

 Convert string into number


1. let a = “1”;
2. let b;

Const b = Number(a) //old

Const b = +a //New

Function in Js
 Types of Functions in Js

1. Function Declaration Statement - Function


Statement
2. Function as Expression – Function expression , First
Class Function
3. Immediate Invoke Function Expression (IIFE) –
Anonymous function
4. Arrow Function – Fat Operator
5. Call back function (CBF)
6. Nested Function

Function statement  Function sum( a+b )


Expression statement  Var a = 10+2 + 3 + 2 = 17

You might also like