-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog.html
130 lines (125 loc) · 5.62 KB
/
blog.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!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>javascript concept</title>
</head>
<body>
<blockquote>
<section>
<h2>What is the difference between localstorage and sessionstorage</h2>
<ul>
<li>
<p>
Local Storage: This read-only interface property provides access to the Documents local storage
object,
the stored data is stored across browser sessions. Similar to sessionStorage, except that
localStorage
data gets cleared when the page session ends that is when the page is closed. It is cleared when
the
last “private” tab of a browser is closed (localStorage data for a document loaded in a private
browsing
or incognito session).
</p>
</li>
<li>
<p> Session Storage: Session Storage objects can be accessed using the sessionStorage read-only
property.
The difference
between sessionStorage and localStorage is that localStorage data does not expire, whereas
sessionStorage data is cleared when the page session ends.
A unique page session gets created once a document is loaded in a browser tab. Page sessions are
valid
for only one tab at a time. Pages are only saved for the amount of time that the tab or the
browser
is
open; they do not persist after the page reloads and restores. A new session is created each
time a
tab
or window is opened; this is different from session cookies. Each tab/window that is opened with
the
same URL creates its own sessionStorage.When you duplicate a tab, the sessionStorage from the
original
tab is copied to the duplicated tab. Closing a window/tab ends the session and clears
sessionStorage
objects.
</p>
</li>
</ul>
</section>
</blockquote>
<blockquote>
<section>
<div>
<h2>what is the difference between global scope and block scope</h2>
</div>
<div>
<ul>
<li>
<p>
The Global scope:
A variable exists inside or outside a block. If a variable is declared outside all functions
or
curly
braces ({}), it exists in the global scope. The global variables can be accessed by any line
of
code in
the program, including inside blocks.
</p>
</li>
<li>
<p>
The Block scope: The main difference between the local scope and block scope is that the
block
statements (e.g. if conditions or for loops), don't create a new scope. So the var keyword
will
not have an effect, because the variables are still in the same scope.
</p>
</li>
</ul>
</div>
</section>
</blockquote>
<blockquote>
<section>
<div>
<h2>How to work javascript event loop</h2>
</div>
<div>
<ul>
<li>
<p>
The Event Loop has one simple job — to monitor the Call Stack and the Callback Queue. If the
Call Stack is empty, the Event Loop will take the first event from the queue and will push
it to
the Call Stack, which effectively runs it. Such an iteration is called a tick in the Event
Loop.
</p>
</li>
</ul>
</div>
</section>
</blockquote>
<blockquote>
<section>
<h2>what is javascript undefined type</h2>
<div>
<ul>
<li>
<p>
The undefined type is a primitive type that has only one value undefined. By default, when a
variable is declared but not initialized, it is assigned the value of undefined.
In this example, the counter is a variable. Since counter hasn't been initialized, it is
assigned the value undefined. The type of counter is also undefined.
It's important to note that the typeof operator also returns undefined when you call it on a
variable that hasn't been declared
</p>
</li>
</ul>
</div>
</section>
</blockquote>
</body>
</html>