Soumettre la recherche
Mettre en ligne
Es51
•
Télécharger en tant que PPTX, PDF
•
0 j'aime
•
660 vues
I
iliakan
Suivre
Technologie
Signaler
Partager
Signaler
Partager
1 sur 40
Télécharger maintenant
Recommandé
EcmaScript 5.1
EcmaScript 5.1
iliakan
Powerpoint News
Powerpoint News
gueste432f3
Architetti, Shamir by EF Cinisello
Architetti, Shamir by EF Cinisello
Shamir By EF
SIBN MobileTech Academy
SIBN MobileTech Academy
SaletteUSA-GlobaCom, Inc. (SaletteUSAtv)
Integrating Things and the smart mobile phone capabilities
Integrating Things and the smart mobile phone capabilities
Marino Linaje Trigueros
وينه
وينه
ab3ad10
Presentation1
Presentation1
gueste432f3
Whale Quick Guide
Whale Quick Guide
Morten Søderquist Li
Recommandé
EcmaScript 5.1
EcmaScript 5.1
iliakan
Powerpoint News
Powerpoint News
gueste432f3
Architetti, Shamir by EF Cinisello
Architetti, Shamir by EF Cinisello
Shamir By EF
SIBN MobileTech Academy
SIBN MobileTech Academy
SaletteUSA-GlobaCom, Inc. (SaletteUSAtv)
Integrating Things and the smart mobile phone capabilities
Integrating Things and the smart mobile phone capabilities
Marino Linaje Trigueros
وينه
وينه
ab3ad10
Presentation1
Presentation1
gueste432f3
Whale Quick Guide
Whale Quick Guide
Morten Søderquist Li
Such A Beautiful Story
Such A Beautiful Story
Fethi KARALI
Latitude and longitude
Latitude and longitude
torioreo
Reportes de-evaluacion-2014-2015
Reportes de-evaluacion-2014-2015
Jose Angel Silva Castillo
Tríptico jornada smarzo2012
Tríptico jornada smarzo2012
Veronica Lopez Yanez
Islandora overview - Drupal Meetup Wellington
Islandora overview - Drupal Meetup Wellington
David Nind
Home Study Questionnaire Joint
Home Study Questionnaire Joint
Jonathan's Place
Συλλογικοί Κατάλογοι & Διαδίκτυο
Συλλογικοί Κατάλογοι & Διαδίκτυο
Levadia Library
Jorge Delgado Work
Jorge Delgado Work
guestf7f830
Brazil All
Brazil All
Elliott Serbian
Tam su cua ba me
Tam su cua ba me
Nguyễn Thành Nam Nguyễn
El patito feo
El patito feo
celiaarroyo
Dizzee Rascal Research Tongue N Cheek
Dizzee Rascal Research Tongue N Cheek
Kelly Cartwright
News Fotoss
News Fotoss
guest0392e01
Increasing Customer Engagement with Social Media
Increasing Customer Engagement with Social Media
Nathan Archibald
В облаке AWS
В облаке AWS
Артём Курапов
Big Book by Yana Yu
Big Book by Yana Yu
Project for Developing Chinese Language Teachers
Raising Fund For Teaching Chinese
Raising Fund For Teaching Chinese
Project for Developing Chinese Language Teachers
Contenu connexe
En vedette
Such A Beautiful Story
Such A Beautiful Story
Fethi KARALI
Latitude and longitude
Latitude and longitude
torioreo
Reportes de-evaluacion-2014-2015
Reportes de-evaluacion-2014-2015
Jose Angel Silva Castillo
Tríptico jornada smarzo2012
Tríptico jornada smarzo2012
Veronica Lopez Yanez
Islandora overview - Drupal Meetup Wellington
Islandora overview - Drupal Meetup Wellington
David Nind
Home Study Questionnaire Joint
Home Study Questionnaire Joint
Jonathan's Place
Συλλογικοί Κατάλογοι & Διαδίκτυο
Συλλογικοί Κατάλογοι & Διαδίκτυο
Levadia Library
Jorge Delgado Work
Jorge Delgado Work
guestf7f830
Brazil All
Brazil All
Elliott Serbian
Tam su cua ba me
Tam su cua ba me
Nguyễn Thành Nam Nguyễn
El patito feo
El patito feo
celiaarroyo
Dizzee Rascal Research Tongue N Cheek
Dizzee Rascal Research Tongue N Cheek
Kelly Cartwright
News Fotoss
News Fotoss
guest0392e01
Increasing Customer Engagement with Social Media
Increasing Customer Engagement with Social Media
Nathan Archibald
В облаке AWS
В облаке AWS
Артём Курапов
Big Book by Yana Yu
Big Book by Yana Yu
Project for Developing Chinese Language Teachers
Raising Fund For Teaching Chinese
Raising Fund For Teaching Chinese
Project for Developing Chinese Language Teachers
En vedette
(17)
Such A Beautiful Story
Such A Beautiful Story
Latitude and longitude
Latitude and longitude
Reportes de-evaluacion-2014-2015
Reportes de-evaluacion-2014-2015
Tríptico jornada smarzo2012
Tríptico jornada smarzo2012
Islandora overview - Drupal Meetup Wellington
Islandora overview - Drupal Meetup Wellington
Home Study Questionnaire Joint
Home Study Questionnaire Joint
Συλλογικοί Κατάλογοι & Διαδίκτυο
Συλλογικοί Κατάλογοι & Διαδίκτυο
Jorge Delgado Work
Jorge Delgado Work
Brazil All
Brazil All
Tam su cua ba me
Tam su cua ba me
El patito feo
El patito feo
Dizzee Rascal Research Tongue N Cheek
Dizzee Rascal Research Tongue N Cheek
News Fotoss
News Fotoss
Increasing Customer Engagement with Social Media
Increasing Customer Engagement with Social Media
В облаке AWS
В облаке AWS
Big Book by Yana Yu
Big Book by Yana Yu
Raising Fund For Teaching Chinese
Raising Fund For Teaching Chinese
Es51
1.
EcmaScript 5.1 MASTERING
NAMESPACES! Илья Кантор http://javascript.ru
2.
История
3.
varuser=<username="John"> <fieldtype="age"value="25"/> <fieldtype="email"value="john@gmail.com"/>
</user> alert(user.field.(@type=="email").@value) 1997 ECMA-262 1st edition 1999 ECMA-2623rd edition 2001 Compact Profile 2004 E4X — ECMA-262 4th ed. 2009 ECMA-2625th edition ??? — ECMA-262Harmony
4.
ECMA-2625th edition
Что нового?
5.
ECMA-2625th edition
Багфиксы
6.
obj={ class:'Menu' }
ES3: ошибка ES5: ok
7.
functiontest(str){ varre=/ok/g alert(re.test(str))
} test("ok") test("ok") // true // ES3: false, ES5: true
8.
alert(parseInt("010")==parseFloat("010")) ES3: false
ES5: true
9.
varobj={ a:1, b:2,
} vararr[1,2,3,] ES3: error ES5: ok
10.
МетаСвойства
11.
writable = false
obj={ class:'Menu' } obj.class='Bird‘ =>obj.class == ‘Menu’
12.
configurable = false
obj={ class:'Menu' } deleteobj.class =>obj.class == ‘Menu’
13.
enumerable = false
Object.prototype.each=... for(propin{}){ // без свойства ‘each’ }
14.
Объявление Object.defineProperty({},"class", {
value:"Menu", writable:false, configurable:false, enumerable:true }) => { “class” : “Menu” } property descriptor
15.
Объявление Object.defineProperties({},{ class:{
value:"Menu", writable:false, configurable:false }, height:{ value:200, configurable:false } }) => { “class” : “Menu”, “height”: 200 }
16.
Закрытие объекта varuser={
name:"Вася", /* ... */ } Object.preventExtensions(user) user.a=5// Нельзя добавлять свойства Object.seal(user) deleteuser.name// Нельзя удалять свойства Object.freeze(user) user.name='Петя'// Нельзя менять свойства
17.
Наследование animal={ canWalk:true
} rabbit=Object.create(animal,{ canRun:{ value:true } }) alert(rabbit.canWalk)// true Object.getPrototypeOf(rabbit) == animal // true
18.
Наследование rabbit=Object.create(animal,{ canRun:{
value:true } }) bird=Object.create(Object.getPrototypeOf(rabbit),{ canFly:{ value:true } })
19.
Геттеры и Сеттеры
user=Object.defineProperty({},"fullName",{ get:function(){ returnthis.firstName+' '+this.lastName }, set:function(value){ vars=value.trim().split(/+/,2) this.firstName=s[0]; this.lastName=s[1] } }) user.fullName="Вася Пупкин" alert(user.lastName)// Пупкин
20.
Геттеры и Сеттеры
varuser={ getfullName(){ returnthis.firstName+' '+this.lastName }, setfullName(value){ vars=value.trim().split(/+/,2) this.firstName=s[0]; this.lastName=s[1] } } user.fullName="Вася Пупкин" alert(user.lastName)// Пупкин
21.
JSON
22.
23.
JSON – любые
объекты functionRoom(number){ this.toJSON=function(){ returnnumber } } event={ title:"Conference", date:newDate(), room:newRoom(22) } JSON.stringify(event) {"title":"Conference","date":"2011-02-15T09:12:06.836Z","room":22}
24.
JSON – любые
объекты functionRoom(number){ this.toJSON=function(){ returnnumber } } event={ title:"Conference", date:newDate(), Date.prototype.toJSON room:newRoom(22) } JSON.stringify(event) {"title":"Conference","date":"2011-02-15T09:12:06.836Z","room":22}
25.
JSON.stringify(str, whitelist) event={
title:"Conference", date:newDate(), domElement:document.body } JSON.stringify(event) => TypeError: Converting circular structure to JSON JSON.stringify(event,["title","date"]) => {"title":"Conference","date":"2011-02-15T09:44:13.419Z"}
26.
JSON.stringify(str, replacer) event={
title:"Conference", date:newDate(), domElement:document.body } JSON.stringify(event,function(key,value){ returnvalue.nodeName?undefined:value }) => {"title":"Conference","date":"2011-02-15T09:44:13.419Z"}
27.
JSON.parse(str) str='{"title":"Conference",
br /> "date":"2011-02-15T09:44:13.419Z"}' event=JSON.parse(str) пробелы
28.
JSON.parse(str) str='{"title":"Conference",
br /> "date":"2011-02-15T09:44:13.419Z"}' event=JSON.parse(str) event.date.getDay() => TypeError: no method 'getDay'
29.
JSON.parse(str, reviver) str='{"title":"Conference",
br /> "date":"2011-02-15T09:44:13.419Z"}' event=JSON.parse(str,function(key,value){ if(key=='date'){ returnnewDate(value) } returnvalue }) event.date.getDay() => 2
30.
bind
31.
bind(this) functionButton(elem){ this.sayHi=function(){
alert('Hi') } elem.onclick=function(){ this.sayHi() }.bind(this) }
32.
bind(this, args) functionButton(elem){
this.say=function(phrase){ alert(phrase) } elem.onclick=function(event,phrase){ this.say(phrase) }.bind(this,'Hi') } @see http://www.prototypejs.org/api/function/bind
33.
Strict mode
34.
use strict "use
strict" ... code ...
35.
use strict functionF(){
"use strict" this.method=function(){ // strict mode inherited } }
36.
use strict alert(010)//
SyntaxError (octal literals deprecated) a=5// ReferenceError (undeclared a) obj.notWritable=...// TypeError deleteobj.notConfigurable// TypeError eval("var a = 5") alert(a)// ReferenceError (undeclared a) arguments.callee// TypeError arguments.caller// TypeError (function(){ alert(this)// undefined вместо window })() with(..)// SyntaxError, 'with' statement
37.
Функции,которые давно ждали
Object.keys(obj) "String".trim() Array.isArray(arr) [...].indexOf/lastIndexOf [...].forEach [...].map [...].filter [...].reduce/reduceRight // ... @seehttp://kangax.github.com/es5-compat-table/
38.
The future is
now ? ECMAScript 5 compatibility table ES5-shim
39.
Harmony
40.
It’s all real
__noSuchMethod__Proxy.create letblock_scoped="yay!" constREALLY="srsly" #(x) { x * x } ifx>zreturn"без скобок" moduleIter="@std:Iteration" return[i*iforiinrange(n)] functionprintf(format,...args)ek_scoped= "yay!" consEALLY= "srsly"
Télécharger maintenant