-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
275 lines (220 loc) · 14.5 KB
/
index.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/css/styles1.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Reenie+Beanie&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/css/prism.css">
<script src="/js/prism.js"></script>
<title>JavaScript Documentation</title>
<link rel="icon" href="/images/icon.png" type="images/x-icon">
</head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-K3L2W4PL0E"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-K3L2W4PL0E');
</script>
<body>
<!-- <div id="time"></div> -->
<!-- <header class="header">
<h1 class="center"><a href="/index.html">JavaScript Documentation</a></h1>
</header> -->
<!-- nav -->
<nav id="navbar">
<div class="mobile">
<div id="menu">
<img src="/images/menu.png" alt="menu button">
</div>
<div class="horizontal">
<img src="/images/close.png" alt="close button">
</div>
<a href="/index.html"><img src="/images/logo.png" alt="logo" width="150" height="60" class="left"></a>
</div>
<ul class="nav">
<li>
<a href="/index.html">Introduction</a>
</li>
<li>
<a href="/html/Basics.html">Basics</a>
</li>
<li>
<a href="/html/expressionAndOperators.html">Expressions and Operators</a>
</li>
<li>
<a href="/html/statements.html">Statements</a>
</li>
<li>
<a href="/html/loops.html">Loops</a>
</li>
<li>
<a href="/html/functions.html">Function</a>
</li>
<li>
<a href="/html/iife.html">Immediately Invoked Function Expression (IIFE)</a>
</li>
<li>
<a href="/html/strings.html">Strings</a>
</li>
<li>
<a href="/html/arrays.html">Arrays</a>
</li>
<li>
<a href="/html/scriptTag.html">Script Tag</a>
</li>
<li>
<a href="/html/console.html">Console</a>
</li>
<li>
<a href="/html/alertPromptConfirm.html">Alert, Prompt, Confirm</a>
</li>
<li>
<a href="/html/BOM_DOM.html">BOM & DOM</a>
</li>
<li>
<a href="/html/walkingTheDOM.html">Walking the DOM</a>
</li>
<li>
<a href="/html/eventsAndOtherDOMProperties.html">Events and Other DOM Properties</a>
</li>
<li>
<a href="/html/practiceProblems.html">Practice Problems</a>
</li>
<li>
<a href="/html/interviewPreparation.html">Interview Preparation</a>
</li>
<li>
<a href="/html/basicFullForm.html">Basic Full Form</a>
</li>
<li>
<a href="/html/unitsOfComputer.html">Units Of Computer</a>
</li>
<li>
<a href="/html/basicGitCommand.html">Basic Git Commands</a>
</li>
</ul>
<div id="time"></div>
</nav>
<!-- main -->
<main id="main-doc">
<header>Introduction</header>
<section>
<article>
<p class="line-height-para">JavaScript is a cross-platform, object-oriented scripting language. It is a small and lightweight language. Inside a host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide programmatic control over them.</p>
<p class="line-height-para">It is used to make web pages alive. It is used to programmatically perform actions within the page. When JavaScript was created, it was initially called "LiveScript". But Java was a very popular language at that time, so it was decided that positioning a language as a "younger brother" of Java would help.</p>
<p class="line-height-para">JavaScript contains a standard library of objects, such as Array, Date, and Math, and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by supplementing it with additional objects; for example:</p>
<ul>
<li class="line-height-para">Client-side JavaScript extends the core language by supplying objects to control a browser and its Document Object Model (DOM). For example, client-side extensions allow an application to place elements on an HTML form and respond to user events such as mouse clicks, form input, and page navigation.</li>
<li class="line-height-para">Server-side JavaScript extends the core language by supplying objects relevant to running JavaScript on a server. For example, server-side extensions allow an application to communicate with a database, provide continuity of information from one invocation to another of the application, or perform file manipulations on a server.</li>
</ul>
<p class="line-height-para">JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.</p>
<p class="line-height-para">JavaScript's dynamic capabilities include runtime object construction, variable parameter lists, function variables, dynamic script creation (via eval), object introspection (via for...in and Object utilities), and source-code recovery (JavaScript functions store their source text and can be retrieved through toString()).</p>
<div>
<h3><u>HTML, CSS and JS:</u></h3>
<span>They can be defined as</span>
</div>
<ul>
<li><p class="line-height-para"><u><b title="Hypertext Markup Language">HTML:</b></u> It is the markup language that we use to structure and give meaning to our web content, for example defining paragraphs, headings, and data tables, or embedding images and videos in the page.</p></li>
<li><p class="line-height-para"><u><b title="Cascading Style Sheet">CSS:</b></u> It is a language of styles that we use to apply styling to our HTML content, for example setting background colors and fonts, and laying out our content in multiple columns.</p></li>
<li><p class="line-height-para"><u><b title="JavaScript">JS:</b></u> It is a scripting language that enables us to create dynamically updating content, control multimedia, animate images, and pretty much everything else.</p></li>
</ul>
</article>
</section>
<!-- What_can_JavaScript_do? -->
<section class="margin-from-top">
<header>What can JavaScript do?</header>
<article>
<ul>
<li class="line-height-li">JavaScript can execute not only in the browser, but also on the server.</li>
<li class="line-height-li">We will use JavaScript as a client as well as server side language.</li>
<li class="line-height-li">JavaScript has evolved greatly as a language and is now used to perform wide variety of tasks.</li>
</ul>
</article>
</section>
<!-- What_can_In-Browser_JavaScript_do -->
<section class="margin-from-top">
<header>What can In-Browser JavaScript do?</header>
<article>
<ul>
<li class="line-height-li">Add new HTML and change existing HTML from DOM.</li>
<li class="line-height-li">React to events like response from server, key press, mouse movement, etc.</li>
<li class="line-height-li">Ajax requests like get, post request from network.</li>
<li class="line-height-li">Get and Set cookies and use local storage.</li>
</ul>
</article>
</section>
<!-- What_make_JavaScript_unique -->
<section class="margin-from-top">
<header>What make JavaScript unique?</header>
<article>
<ul>
<li class="line-height-li">HTML and CSS support.</li>
<li class="line-height-li">simple things, i.e., simple API</li>
<li class="line-height-li">supports major modern browsers (enabled by default).</li>
</ul>
</article>
</section>
<!-- JavaScript_versions -->
<section class="margin-from-top">
<header>JavaScript versions</header>
<article>
<p class="line-height-para">JavaScript was invented by Brendan Eich in 1995. It was developed for Netscape 2, and became the ECMA-262 standard in 1997. After Netscape handed JavaScript over to ECMA, the Mozilla foundation continued to develop JavaScript for the Firefox browser. Mozilla's latest version was 1.8.5. (Identical to ES5). Internet Explorer (IE4) was the first browser to support ECMA-262 Edition 1 (ES1).</p>
<ul>
<li class="line-height-li">maintained by community</li>
<li class="line-height-li">First version in 1997</li>
<li class="line-height-li">Second version in 1998</li>
<li class="line-height-li">Third version in 1999</li>
<li class="line-height-li">few releases, and latest version is ECMA 2015. Wherever the talk is about ECMA, it is about JavaScript. ECMA 2016, 17, 18, and every year it changes and you will see newer versions of ES like ES5, ES6.</li>
<li>latest version is ECMAScript 2020</li>
</ul>
</article>
</section>
<section>
<h1 id="officialDocumentation"><a href="https://tc39.es/ecma262/" target="_blank">Official Documentation</a></h1>
</section>
<!-- What you should already know -->
<section class="margin-from-top">
<header>What you should already know</header>
<article>
<p class="line-height-para">This guide assumes you have the following basic background:</p>
<ul>
<li class="line-height-li">A general understanding of the Internet and the World Wide Web (WWW).</li>
<li class="line-height-li">Good working knowledge of HyperText Markup Language (HTML).</li>
<li class="line-height-li">Some programming experience. If you are new to programming, try one of the tutorials linked on the main page about JavaScript.</li>
</ul>
</article>
</section>
<!-- JavaScript and Java -->
<section class="margin-from-top">
<header>JavaScript and Java</header>
<article>
<p class="line-height-para">JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.</p>
<p class="line-height-para">In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.</p>
<p class="line-height-para">JavaScript is a very free-form language compared to Java. You do not have to declare all variables, classes, and methods. You do not have to be concerned with whether methods are public, private, or protected, and you do not have to implement interfaces. Variables, parameters, and function return types are not explicitly typed.</p>
</article>
</section>
<!-- Hello world -->
<section class="margin-from-top">
<header>Hello World</header>
<article>
<p class="line-height-para">To get started with writing JavaScript, open the Scratchpad and write your first "Hello world" JavaScript code:</p>
<pre class="language-js"><code>console.log("Hello world!");</code></pre>
<p class="line-height-para">Select the code in the pad and hit Ctrl+R to watch it unfold in your browser!</p>
</article>
</section>
<!-- <button value="prev"><a href="">PREV</a></button> -->
<button value="next" class="btn"><a href="/html/Basics.html">NEXT</a></button>
<hr class="before-copyright">
<!-- copyright -->
<!-- <footer class="footer"> -->
<p class="footer">© 2023 by Anubhav Tiwari. All rights reserved.</p>
<!-- </footer> -->
</main>
<script src="/js/script.js"></script>
</body>
</html>