-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
488 lines (466 loc) · 20.8 KB
/
Copy pathindex.html
File metadata and controls
488 lines (466 loc) · 20.8 KB
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Introduction To Javascript</title>
<meta name="description" content="Presentation on Javascript by Kapil Kumawat">
<meta name="author" content="Kapil Kumawat">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="apple-touch-icon" sizes="57x57" href="img/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="img/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="img/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="img/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="img/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="img/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="img/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="img/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon/favicon-16x16.png">
<link rel="manifest" href="img/favicon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="img/favicon/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="js/reveal.js/css/reveal.css">
<link rel="stylesheet" href="js/reveal.js/css/theme/moon.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="js/reveal.js/lib/css/zenburn.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<style >
.past iframe, .future iframe {
display: none;;
}
.columns {
-webkit-column-count: 4;
-moz-column-count: 4;
-ms-column-count: 4;
-o-column-count: 4;
column-count: 4;
font-size: 80% !important;
list-style: none !important;
}
.columns2 {
-webkit-column-count: 2;
-moz-column-count: 2;
-ms-column-count: 2;
-o-column-count: 2;
column-count: 2;
display: block !important;
font-size: 80% !important;
list-style: none !important;
}
iframe {
width: 100% !important;
height: 400px !important;
}
.fixed-top {
position: fixed;
top: -50px;
left: 0px;
background-color: #002B36;
width: 100% !important;
height: 600px !important;
max-width: 100% !important;
max-height: 800px !important;
}
.open-frame {
cursor: pointer;
color: #D8971B;
}
.reveal .slide-background.present {
background-size: contain;
}
</style>
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<!--Add support for earlier versions of Internet Explorer -->
<!--[if lt IE 9]>
<script src="js/reveal.js/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- Wrap the entire slide show in a div using the "reveal" class. -->
<div class="reveal">
<!-- Wrap all slides in a single "slides" class -->
<div class="slides">
<!-- ALL SLIDES GO HERE -->
<!-- Each section element contains an individual slide -->
<section>
<h1>Introduction to Javascript</h1>
<p>
<small>
By Kapil Kumawat
</small>
</p>
</section>
<section>
<h2>Topics</h2>
<ul>
<li>Introduction</li>
<li>Functions</li>
<li>Objects</li>
<li>Patterns</li>
</ul>
<p><small>Press c from keyboard to open editor in any page.</small></p>
</section>
<section>
<section>
<h2>Introduction</h2>
<ul>
<li class="fragment">Language for programming interactive web pages,</li>
<li class="fragment">ECMAScript 1997</li>
<li class="fragment">ES3 1999</li>
<li class="fragment">ES5 2009</li>
<li class="fragment">ES4 2006</li>
</ul>
<aside class="notes">
JavaScript’s popularity led to its
formalization in 1997 as an international standard, known officially
as ECMAScript. Today there are many competing implementations of
JavaScript providing conformance to various versions of the ECMAScript
standard.
The third edition of the ECMAScript standard (commonly referred
to as ES3), which was finalized in 1999, continues to be the most
widely adopted version of Java Script. The next major advancement to
the standard was Edition 5, or ES5, which was released in 2009. ES5
introduced a number of new features as well as standardizing some
widely supported but previously unspecified features.
</aside>
</section>
<section>
<h2>JavaScript Syntax</h2>
<ul>
<li class="fragment">Case sensitivity</li>
<li class="fragment">Whitespace</li>
<li class="fragment">Semicolons</li>
<li class="fragment">Comments</li>
<li class="fragment">Identifiers</li>
<li class="fragment">Keywords</li>
</ul>
</section>
<section>
<h2>JavaScript Data Types</h2>
<ul>
<li>null</li>
<li>undefined</li>
<li>boolean</li>
<li>numbers</li>
<li>string</li>
<li>object</li>
<li>symbol -- added in ES6!</li>
</ul>
</section>
<section>
<h2>JavaScript Data Types</h2>
<p>typeof: operator inspects the type of the given value</p>
<rframe data-media="typeof" src="codemirror.html"></rframe>
</section>
<section>
<h2>JavaScript Syntax Cont.</h2>
<p>Special mention:</p>
<ul class="fragment">
<li >"use strict";</li>
</ul>
<rframe class="fragment" data-media="usestrict" src="codemirror.html"></rframe>
</section>
<section>
<h2>JavaScript Syntax Cont.</h2>
<p>Special mention:</p>
<ul class="fragment">
<li >undefined, NaN and null</li>
<li>isNaN</li>
<li>=== vs ==</li>
</ul>
<rframe class="fragment" data-media="undefinednannull" src="codemirror.html"></rframe>
</section>
<section>
<h2>Value vs. Reference</h2>
<rframe class="valueref" data-media="undefinednannull" src="codemirror.html"></rframe>
</section>
</section>
<section>
<section>
<h2>Functions</h2>
<ul>
<li>Encloses the set of statements</li>
<li>Functions are objects</li>
<li>Functions Calling</li>
</ul>
<rframe class="functions" data-media="function" src="codemirror.html"></rframe>
</section>
<section>
<h2>Ways of Calling Functions</h2>
<ul>
<li>()</li>
<li>.call()</li>
<li>.apply()</li>
</ul>
<rframe data-media="functioncalling" src="codemirror.html"></rframe>
</section>
<section>
<h2>Scope os function</h2>
<p>Scoping in Javascript</p>
<rframe data-media="functionscope" src="codemirror.html"></rframe>
<p>Function-level scope</p>
</section>
<section>
<h2>Functions Dec vs Exp</h2>
<p>Function Declaration vs Function Expression</p>
<rframe data-media="function" src="codemirror.html"></rframe>
</section>
<section>
<h2>Functions SIFE</h2>
<p>SIFE(Self Invoking Function Expression)</p>
<p><small>A self-invoking anonymous runs automatically/immediately when you create it and has no name, hence called anonymous</small></p>
<rframe data-media="sife" src="codemirror.html"></rframe>
</section>
<section>
<h2>Functions Hoisting</h2>
<p>Hoisted</p>
<rframe data-media="hoisting" src="codemirror.html"></rframe>
<p><a href="http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html" target="_blank">Refer</a></p>
</section>
<section>
<h2>Functions Cont.</h2>
<p>Closures</p>
<p><small>A closure—unlike a plain function pointer—enables a function to access those non-local variables even when invoked outside its immediate lexical scope.</small></p>
<rframe data-media="closure" src="codemirror.html"></rframe>
<p><small>Create Calculator Like this Sum(5)(10) should return 10</small></p>
</section>
</section>
<section>
<section>
<h2>Objects</h2>
<ul class="fragment">
<li>Collection of property-value.</li>
<li>A property name can be any string, including the empty string.</li>
<li>Value can have any defined Datatype of Javascript including other objects.</li>
<li>Objects in JavaScript are class-free.</li>
</ul>
</section>
<section>
<h2>Create Objects</h2>
<p>Three common ways to create new objects</p>
<rframe class="fragment" data-media="objectcre" src="codemirror.html"></rframe>
</section>
<section>
<h2>Objects Properties</h2>
<p>Four common ways to create new properties of objects</p>
<rframe class="fragment" data-media="objectprop" src="codemirror.html"></rframe>
<p>Refer <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties">defineProperties and defineProperty</a>.</p></p>
</section>
<section>
<h2>Objects Cont.</h2>
<p>Few common things to note:</p>
<ul>
<li>Prototype
<ul>
<li>Delegation / Prototype Chain</li>
</ul>
</li>
<li>Reflection
<ul>
<li>typeof</li>
<li>hasOwnProperty</li>
</ul>
</li>
</ul>
</section>
<section>
<h2>Object Functions Model</h2>
<img style="height: 475px;background-color: lightgrey" src="http://i.stack.imgur.com/KFzI3.png">
</section>
</section>
<section>
<section>
<h2>JavaScript Object Creation</h2>
<ul>
<li>Basic</li>
<li>Prototype Pattern</li>
<li>Module Pattern</li>
<li>Closures Pattern</li>
</ul>
</section>
<section>
<h2>Singleton class</h2>
<p2><small>Lets use this knowledge and create a Singleton Object</small></p2>
</section>
<section>
<h2>Singleton class Method 1</h2>
<p>Method 1</p>
<rframe data-media="singleton1" src="codemirror.html"></rframe>
</section>
<section>
<h2>Singleton class Method 2</h2>
<p>Method 2</p>
<rframe data-media="singleton2" src="codemirror.html"></rframe>
</section>
</section>
<section>
<section>
<h2>Debugger Demo</h2>
<ul>
<li>$_,$0-4,$$</li>
<li>debug/undebug</li>
<li>monitor/unmonitor</li>
<li>monitorEvents/unmonitorEvents</li>
<li>console</li>
<li>blackbox</li>
<li>breakpoints</li>
</ul>
<p><a href="https://developers.google.com/web/tools/chrome-devtools/debug/command-line/" target="_blank">Refer</a></p>
</section>
<section>
<h2>Console Object</h2>
<ul>
<li>console.log, console.error, console.dir(object)</li>
<li>console.group(title), console.groupCollapsed,console.groupEnd</li>
<li>console.time(label), console.timeEnd(label)</li>
<li>console.table</li>
<li>console.clear</li>
<li>console.trace</li>
<li>console.count</li>
</ul>
<p>pass css class to console.</p>
<p><a href="https://developers.google.com/web/tools/chrome-devtools/debug/console/console-reference" target="_blank">Refer</a></p>
</section>
</section>
<section>
<section>
<h2>Future Sessions</h2>
<ul>
<li>OOPS Programming</li>
<li>DOM Manipulation</li>
<li>Design Patterns</li>
<li>CSS Basics</li>
<li>Memory Leaks</li>
<li>jQuery</li>
</ul>
</section>
</section>
<section>
<h2>Thank You</h2>
<p><small>Contact me at <a href="mailto:kapil@ask4kapil.xyz">kapil@ask4kapil.xyz</a></small></p>
<p><small>Source code of this presentation at <a href="https://github.com/kk20994/IntroToJavascript">Github</a></small></p>
</section>
</div>
</div>
<script src="js/reveal.js/lib/js/head.min.js"></script>
<script src="js/reveal.js/js/reveal.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
slideNumber: true,
center: true,
transition: 'fade', // default/cube/page/concave/zoom/linear/fade/none
// Parallax scrolling
// parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
// parallaxBackgroundSize: '2100px 900px',
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'js/reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'js/reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'js/reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'js/reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'js/reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'js/reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
$(document).ready(function () {
var curSlide = Reveal.getCurrentSlide();
if(curSlide.querySelector("rframe")) {
var iframe = document.createElement('iframe'),
rframe = curSlide.querySelector("rframe");
iframe.setAttribute('data-media', rframe.getAttribute('data-media'));
iframe.setAttribute('src', 'codemirror.html');
rframe.appendChild(iframe);
}
Reveal.addEventListener("slidechanged",function(event){
var curSlide = event.currentSlide,
prevSlide = event.previousSlide;
if(curSlide.querySelector("rframe")) {
var iframe = document.createElement('iframe'),
rframe = curSlide.querySelector("rframe");
iframe.setAttribute('data-media', rframe.getAttribute('data-media'));
iframe.setAttribute('src', 'codemirror.html');
rframe.appendChild(iframe);
Reveal.layout();
}
if(prevSlide.querySelector("iframe")) {
$(prevSlide).find('iframe').remove();
}
ga('send', 'pageview', {
'page': event.indexh,
'title': document.title + ' : Slide ' + event.indexh
});
});
window.openFrame = function(mode) {
var currentSlide = $(Reveal.getCurrentSlide());
if(currentSlide.find('iframe').length === 0) {
var iframe = document.createElement('iframe');
iframe.setAttribute('src', 'codemirror.html');
iframe.setAttribute('data-media', mode);
iframe.classList.add('fixed-top');
currentSlide.append(iframe);
}
else {
currentSlide.find('iframe').remove()
}
};
window.closeIframe = function() {
$(Reveal.getCurrentSlide()).find('iframe').remove();
};
document.addEventListener("keypress", function (event) {
var key = event.which || event.keyCode;
if (key === 99) { // 13 is enter
var currentSlide = $(Reveal.getCurrentSlide());
if(currentSlide[0].querySelector("rframe") && currentSlide.find('iframe').length === 0) {
var iframe = document.createElement('iframe'),
rframe = currentSlide[0].querySelector("rframe");
iframe.setAttribute('data-media', rframe.getAttribute('data-media'));
iframe.setAttribute('src', 'codemirror.html');
rframe.appendChild(iframe);
Reveal.layout();
}
else if(currentSlide.find('iframe').length === 0) {
var iframe = document.createElement('iframe');
iframe.setAttribute('src', 'codemirror.html');
iframe.classList.add('fixed-top');
currentSlide.append(iframe);
}
else {
currentSlide.find('iframe').remove()
}
}
});
});
</script>
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='https://www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-68034491-1','auto');ga('send','pageview');
</script>
</body>
</html>