Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHPerから見た昨今のJSについて

polidog
March 14, 2015

 PHPerから見た昨今のJSについて

polidog

March 14, 2015
Tweet

More Decks by polidog

Other Decks in Technology

Transcript

  1. ࠓ೔࿩͢ػೳ 1. ؔ਺(Arrow functions,Function Argumentss) 2. ม਺(let + const) 3.

    Ϋϥε(classes) 4. δΣωϨʔλͱfor of 5. άϩʔόϧΦϒδΣΫτ(Map,Set, WeakMap, WeakSet) 6. Promises
  2. 1. ؔ਺ var test = a => { console.log(“execute!! :

    ”+a); } function a(x, y=12) { } function b(x, ...y) { } function c(x,y,z) {} args = [1,2,3] c(…args);
  3. 4. δΣωϨʔλͱfor of let gen = function*() { for(let i

    = 0; i < 10; i++) { yield i+10; } } for (let i of gen()) { console.log(i) }
  4. 5. άϩʔόϧΦϒδΣΫτ var set = new Set(); set.add(“hoge”).add(“fuga”) var map

    = new Map(); map.set(“hoge”,10); map.set(“fuga”,20);
  5. 6. Promises function timeout(duration = 0) { return new Promise((resolve,

    reject) => { setTimeout(resolve, duration); }) } var p = timeout(1000).then(() => { return timeout(2000); }).then(() => { throw new Error("hmm"); }).catch(err => { return Promise.all([timeout(100), timeout(200)]); })
  6. Φϓγϣϯ(flag)͕ඞཁ • shipping features → ϑϥάඞཁͳ͍ • staged features →

    --es_staging͕ඞཁ • in progress features → ݸผʹϑϥάࢦఆ͕ඞ ཁ