Skip to content

Commit 445b45f

Browse files
author
Gery_Cookie
committed
More slides
1 parent 0a06ff0 commit 445b45f

1 file changed

Lines changed: 52 additions & 227 deletions

File tree

‎Topics/08. ES6-Features/README.md‎

Lines changed: 52 additions & 227 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
- Async operations
2424
- Promises
2525
- Callbacks with arrow functions
26+
27+
<!-- attr: { id:'', showInPresentation:true, hasScriptWrapper:true } -->
28+
# Table of Contents
2629
- Modules
2730
- imports, exports, compitability
2831
- Strings
@@ -31,6 +34,10 @@
3134
- Numbers
3235
- Binary, Octal and hexadecimal literals
3336
- Math methods
37+
38+
<!-- attr: { id:'', showInPresentation:true, hasScriptWrapper:true } -->
39+
# Table of Contents
40+
3441
- Functions
3542
- Arrоw functions
3643
- Preserving `this`
@@ -39,6 +46,10 @@
3946
- `Array.of()`
4047
- `Array.from()`
4148
- spread operator
49+
50+
<!-- attr: { id:'', showInPresentation:true, hasScriptWrapper:true } -->
51+
# Table of Contents
52+
4253
- Data Types
4354
- Symbols
4455
- Objects
@@ -119,6 +130,8 @@ MAX_VALUE = 15; // throws exception
119130
console.log(`The number is ${number}`);
120131
}
121132
```
133+
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
134+
# Loops
122135

123136
- Or iteratable objects (objects that have `Symbol.iterator`):
124137
- Discussed in detail later
@@ -180,173 +193,19 @@ for (let person of people){
180193

181194
<!-- section start -->
182195

183-
184-
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
185-
# Classes and Inheritance in ES6
186-
- ES6 introduces classes and a way to create classical OOP
187-
188-
```javascript
189-
class Person extends Mammal {
190-
constructor(fname, lname, age) {
191-
super(age);
192-
this._fname = fname;
193-
this._lname = lname;
194-
}
195-
get fullname() {
196-
//getter property of fullname
197-
}
198-
set fullname(newfullname) {
199-
//setter property of fullname
200-
}
201-
// more class members…
202-
}
203-
```
204-
205-
206-
207-
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
208-
# Classes and Inheritance in ES6
209-
- ES6 introduces classes and a way to create classical OOP
210-
211-
```javascript
212-
class Person extends Mammal {
213-
constructor(fname, lname, age) {
214-
super(age);
215-
this._fname = fname;
216-
this._lname = lname;
217-
}
218-
get fullname() {
219-
//getter property of fullname
220-
}
221-
set fullname(newfullname) {
222-
//setter property of fullname
223-
}
224-
// more class members…
225-
}
226-
```
227-
228-
<div class="fragment balloon" style="top:35.42%; left:54.30%; width:41.45%">Constructor of the class</div>
229-
230-
231-
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
232-
# Classes and Inheritance in ES6
233-
- ES6 introduces classes and a way to create classical OOP
234-
235-
```javascript
236-
class Person extends Mammal {
237-
constructor(fname, lname, age) {
238-
super(age);
239-
this._fname = fname;
240-
this._lname = lname;
241-
}
242-
get fullname() {
243-
//getter property of fullname
244-
}
245-
set fullname(newfullname) {
246-
//setter property of fullname
247-
}
248-
// more class members…
249-
}
250-
```
251-
252-
<div class="fragment balloon" style="top:56.84%; left:55.19%; width:41.45%">Getters and setters</div>
253-
<div class="fragment balloon" style="top:35.42%; left:54.30%; width:41.45%">Constructor of the class</div>
254-
255-
256-
257-
258-
259-
260-
<!-- section start -->
261-
262-
263-
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
264-
# Arrow Functions
265-
- Arrow functions easify the creation of functions:
266-
267-
268-
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
269-
# Arrow Functions
270-
- Arrow functions easify the creation of functions:
271-
272-
```javascript
273-
numbers.sort(function(a, b){
274-
return b – a;
275-
});
276-
```
277-
278-
279-
280-
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
281-
# Arrow Functions
282-
- Arrow functions easify the creation of functions:
283-
284-
```javascript
285-
numbers.sort(function(a, b){
286-
return b – a;
287-
});
288-
```
289-
290-
291-
```javascript
292-
numbers.sort((a, b) => b – a);
293-
```
294-
295-
296-
```javascript
297-
Becomes
298-
```
299-
300-
301-
302196
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
303197
# Arrow Functions
304198
- Arrow functions easify the creation of functions:
305199

306-
```javascript
307-
numbers.sort(function(a, b){
308-
return b – a;
309-
});
310-
```
311-
312-
313-
```javascript
314-
numbers.sort((a, b) => b – a);
315-
```
316-
317-
318-
```javascript
319-
var fullnames =
320-
people.filter(function (person) {
321-
return person.age >= 18;
322-
}).map(function (person) {
323-
return person.fullname;
324-
});
325-
```
326-
327-
328-
```javascript
329-
Becomes
330-
```
331-
332-
333200

334201
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
335202
# Arrow Functions
336203
- Arrow functions easify the creation of functions:
337204

338-
```javascript
339-
numbers.sort(function(a, b){
340-
return b – a;
341-
});
342-
```
343-
344-
345205
```javascript
346206
numbers.sort((a, b) => b – a);
347207
```
348208

349-
350209
```javascript
351210
var fullnames =
352211
people.filter(function (person) {
@@ -356,29 +215,6 @@ var fullnames =
356215
});
357216
```
358217

359-
360-
```javascript
361-
var fullnames2 =
362-
people.filter(p => p.age >= 18)
363-
.map(p => p.fullname);
364-
```
365-
366-
367-
```javascript
368-
Becomes
369-
```
370-
371-
372-
```javascript
373-
Becomes
374-
```
375-
376-
377-
378-
379-
380-
381-
382218
<!-- section start -->
383219

384220

@@ -400,44 +236,35 @@ let person = {
400236

401237
```javascript
402238
let name = 'Doncho Minkov';
403-
let person = {
404-
name,
405-
age
406-
};
239+
let person = { name, age };
407240
```
408241

409-
410-
411-
412-
413-
414-
415242
<!-- section start -->
416243

417244

418-
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
245+
<!-- attr: { showInPresentation:true, hasScriptWrapper:true, style: 'font-size: 0.9em' } -->
419246
# Destructuring Assignments
420247
- Destructuring assignments allow to set values to objects in an easier way:
421248
- Destructuring assignments with arrays:
422249

423-
```javascript
424-
var [a,b] = [1,2]; //a = 1, b = 2
425-
var [x, , y] = [1, 2, 3] // x = 1, y = 3
426-
var [first, second, ...rest] = people;
427-
```
250+
```javascript
251+
var [a,b] = [1,2]; //a = 1, b = 2
252+
var [x, , y] = [1, 2, 3] // x = 1, y = 3
253+
var [first, second, ...rest] = people;
254+
```
428255

429256
- Swap values:
430257

431-
```javascript
432-
[x, y] = [y, x]
433-
```
258+
```javascript
259+
[x, y] = [y, x]
260+
```
434261

435262
- Result of method:
436263

437-
```javascript
438-
function get(){ return [1, 2, 3]; }
439-
var [x, y] = get();
440-
```
264+
```javascript
265+
function get(){ return [1, 2, 3]; }
266+
var [x, y] = get();
267+
```
441268

442269

443270

@@ -490,42 +317,40 @@ import classes from './persons'
490317
import {Mammal, Person} form '.persons'
491318
```
492319

493-
494-
```javascript
495-
persons.js
496-
```
497-
498-
499-
500-
501-
502-
503-
504320
<!-- section start -->
505321

506322

507323
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
508-
# Extenden parameter handling
324+
# Extended parameter handling
509325
- Simple and intuitive default values for function parameters
510326
- Aggregation of remaining arguments into single parameter of variadic functions
511327
- Spreading of elements of an interable collection
512-
- function f (x, y = 7, z = 42) { return x + y + z }
513-
- f(1) // 50
514-
515-
```javascript
516-
function f (x, y, ...a) { return (x + y) * a.length }
517-
f(1, 2, "hello", true, 7) // 9
518-
```
519328

329+
```javascript
330+
function f (x, y = 7, z = 42) { return x + y + z }
331+
f(1) // 50
520332

521-
```javascript
522-
var params = [ "hello", true, 7 ]
523-
var other = [ 1, 2, ...params ]
524-
f(1, 2, ...params) // 9
525-
```
333+
function f (x, y, ...a) { return (x + y) * a.length }
334+
f(1, 2, "hello", true, 7) // 9
335+
```
526336

527337

528338

529-
<!-- attr: { showInPresentation:true, hasScriptWrapper:true } -->
530-
# JavaScript.next
531-
- http://academy.telerik.com
339+
<!-- Questions -->
340+
<!-- section start -->
341+
<!-- attr: { hasScriptWrapper:true, showInPresentation:true, class:"slide-questions", id:"questions" } -->
342+
<!-- # ES6 Classes and Class Constructors
343+
## Questions? -->
344+
345+
<!-- attr: { showInPresentation:true, hasScriptWrapper:true, style:'font-size: 0.9em' } -->
346+
# Free Trainings @ Telerik Academy
347+
- "Web Design with HTML 5, CSS 3 and JavaScript" course @ Telerik Academy
348+
- [javascript course](http://academy.telerik.com/student-courses/web-design-and-ui/javascript-fundamentals/about)
349+
- Telerik Software Academy
350+
- [academy.telerik.com](http://academy.telerik.com)
351+
- Telerik Academy @ Facebook
352+
- [facebook.com/TelerikAcademy](https://facebook.com/TelerikAcademy)
353+
- Telerik Software Academy Forums
354+
- [forums.academy.telerik.com](https://telerikacademy.com/Forum/Home)
355+
356+
<!-- <img class="slide-image" showInPresentation="false" src="imgs/pic00.png" style="top:58.18%; left:90.52%; width:16.97%; z-index:-1" /> -->

0 commit comments

Comments
 (0)