ecma script 5

37
The Future of JavaScript (ECMAScript-5) Alexander Tarasyuk

Upload: alexander-tarasyuk

Post on 03-Jul-2015

494 views

Category:

Technology


1 download

DESCRIPTION

Demo code https://github.com/AlexanderTarasyuk/ECMAScript5

TRANSCRIPT

The Future of JavaScript (ECMAScript-5)

Alexander Tarasyuk

Array• indexOf()• lastIndexOf()• every()• filter()• forEach()• map()• some()• isArray()• reduce()• reduceRight()

2

3

indexOf

4

lastIndexOf

5

every

6

filter

7

forEach

8

map

9

some

10

isArray

11

reduce

12

reduceRight

String• trim()

13

Date• now()• toISOString()

14

15

toISOString

Object• create()• defineProperty()• defineProperties()• keys()• getOwnPropertyDescriptor()• getOwnPropertyNames()• getPrototypeOf()• seal()• isSealed()• freeze()• isFrozen()• preventExtensions()• isExtensible()

16

17

create

18

Inheritance

19

defineProperty

20

writable, configurable, enumerable

21

getters / setters

22

keys

23

getOwnPropertyNames

24

getOwnPropertyDescriptor

25

getPrototypeOf

26

seal, isSealed

27

freeze, isFrozen

28

preventExtensions, isExtensible

JSON• parse()• stringify()

29

30

parse

31

stringify

Function• bind()

32

33

bind

Strict Mode• eval('"\010"')- is a SyntaxError• eval('010')- is a SyntaxError• __i_dont_exist = 1; - is a ReferenceError• eval = 1; - is a SyntaxError• arguments = 1; - is a SyntaxError• eval++; - is a SyntaxError• arguments++; - is a SyntaxError• arguments.caller; - is a TypeError• (function(x){ x = 2; return arguments[0] === 1; })(1);• (function(x){ arguments[0] = 2; return x === 1; })(1);• ({ x: 1, x: 1 }); - is a SyntaxError• ({ set x(eval){ } }); - is a SyntaxError• ({ set x(arguments){ } }); - is a SyntaxError• eval('var x'); x; - is a ReferenceError• (function(){ return this === undefined; })();• (function(){ return this === undefined; }).call();• var x; delete x; - is a SyntaxError• delete (function(){}).length; - is a TypeError• (function f() { f = 123; })() - is a TypeError• Object.defineProperty({ }, "x", { writable: false }).x = 1• .......

34

Compatibility table

35

ECMASCript-6• let• function main(a = 1) {} • const• Proxy Objects• module• import• yield • ......

36

Thank You