{"id":371,"date":"2017-05-30T14:00:50","date_gmt":"2017-05-30T05:00:50","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2017\/05\/30\/ecmascript02"},"modified":"2022-10-26T06:57:12","modified_gmt":"2022-10-25T21:57:12","slug":"ecmascript02","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2017\/05\/30\/ecmascript02\/","title":{"rendered":"\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u5b66\u7fd2 ECMAScript \u7b2c2\u56de"},"content":{"rendered":"

\u524d\u56de<\/a>\u306b\u5f15\u304d\u7d9a\u304dECMAScript<\/strong>\u3092\u307e\u3068\u3081\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

\u4eca\u56de\u306f\u524d\u56de\u7d39\u4ecb\u3067\u304d\u306a\u304b\u3063\u305f\u3001\u95a2\u6570<\/strong> \u7d44\u307f\u8fbc\u307f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong> \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u69cb\u6587<\/strong> \u306b\u3064\u3044\u3066\u3067\u3059\u3002<\/p>\n


\n

\u95a2\u6570<\/h2>\n

\u30c7\u30d5\u30a9\u30eb\u30c8\u5024<\/h3>\n

\u5f93\u6765\u306eJavaScript\u3067\u306f\u3001\u5f15\u6570\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u305a\u3001\u5f15\u6570\u304c\u6e21\u305b\u3055\u308c\u3066\u3044\u308b\u304b\u306e\u30c1\u30a7\u30c3\u30af\u3092\u3057\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3068\u3044\u3063\u305f\u51e6\u7406\u3092\u66f8\u304b\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001ECMAScript6\u3067\u306f\u5f15\u6570\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u30bb\u30c3\u30c8\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n

const show = (name = '\u592a\u90ce') => {\n  console.log(`\u79c1\u306e\u540d\u524d\u306f${name}\u3067\u3059`);\n};\n\nshow();\n\/\/ \u7d50\u679c\uff1a\u79c1\u306e\u540d\u524d\u306f\u592a\u90ce\u3067\u3059\n\nshow('\u82b1\u5b50');\n\/\/ \u7d50\u679c\uff1a\u79c1\u306e\u540d\u524d\u306f\u82b1\u5b50\u3067\u3059<\/code><\/pre>\n

\u3053\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u9069\u5fdc\u3055\u308c\u308b\u306e\u306f\u3001\u5f15\u6570\u304c\u672a\u6307\u5b9a\u306e\u5834\u5408\u306e\u307f\u3067\u3059\u3002
\nnull\u3084false\u306a\u3069\u304c\u6e21\u3055\u308c\u305f\u5834\u5408\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002<\/p>\n

\u307e\u305f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306b\u95a2\u6570\u3092\u6307\u5b9a\u3067\u304d\u308b\u306e\u3067\u3001\u5f15\u6570\u304c\u306a\u3044\u5834\u5408\u306b\u30a8\u30e9\u30fc\u3068\u8fd4\u3059\u3068\u3044\u3046\u51e6\u7406\u3082\u5b9f\u73fe\u53ef\u80fd\u3067\u3059\u3002<\/p>\n

const required = () => {\n  console.error('\u5fc5\u9808\u9805\u76ee\u306b\u306a\u308a\u307e\u3059\u3001\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044');\n};\n\nconst hoge = (value = required()) => {\n  return value;\n};\n\nhoge();\n\/\/ \u7d50\u679c\uff1a\u5fc5\u9808\u9805\u76ee\u306b\u306a\u308a\u307e\u3059\u3001\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044<\/code><\/pre>\n

\u53ef\u5909\u9577\u5f15\u6570<\/h3>\n

\u4eee\u5f15\u6570\u306b ...<\/code> \u3092\u4ed8\u4e0e\u3059\u308b\u3053\u3068\u3067\u3001\u53ef\u5909\u9577\u5f15\u6570\u3068\u306a\u308a\u307e\u3059\u3002
\n\u3053\u308c\u306f\u3001\u6e21\u3055\u308c\u305f\u4efb\u610f\u500b\u6570\u306e\u5f15\u6570\u3092\u914d\u5217\u3068\u3057\u3066\u307e\u3068\u3081\u3066\u53d7\u3051\u53d6\u308b\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n

\u5f93\u6765\u306eJavaScript\u3067\u306farguments\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4ecb\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u3053\u306e\u3088\u3046\u306a\u3057\u304f\u307f\u304c\u7528\u610f\u3055\u308c\u305f\u4e8b\u306b\u3088\u308a\u3050\u3093\u3068\u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027\u304c\u5411\u4e0a\u3057\u307e\u3057\u305f\u306d\uff01<\/p>\n

const sum = (...args) => {\n  let result = 0;\n  for (let arg of args) {\n    result += arg;\n  }\n  return result;\n}\n\nconsole.log(sum(10, 20, 30));\n\/\/ \u7d50\u679c\uff1a60<\/code><\/pre>\n

\u30a2\u30ed\u30fc\u95a2\u6570<\/h3>\n

\u30a2\u30ed\u30fc\u95a2\u6570\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u95a2\u6570\u30ea\u30c6\u30e9\u30eb\u3092\u30b7\u30f3\u30d7\u30eb\u306b\u8a18\u8ff0\u3067\u304d\u307e\u3059\u3002<\/p>\n

[\u5f93\u6765\u306e\u95a2\u6570\u30ea\u30c6\u30e9\u30eb\u3067\u306e\u8868\u8a18]<\/strong><\/p>\n

let data = [1, 2, 3];\nlet formatted = data.map((value, index) => {\n  return value * value;\n});<\/code><\/pre>\n

[\u30a2\u30ed\u30fc\u95a2\u6570\u306b\u3088\u308b\u8868\u8a18]<\/strong><\/p>\n

let data = [1, 2, 3];\nlet formatted = data.map((value, index) => value * value);<\/code><\/pre>\n

\u7d44\u307f\u8fbc\u307f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h2>\n

Promise\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h3>\n

Promise\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u975e\u540c\u671f\u51e6\u7406\u3092\u540c\u671f\u51e6\u7406\u306e\u3088\u3046\u306b\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002
\njQuery\u306e$.defened\u3084AngularJS\u306e$.q\u306a\u3069\u3001\u985e\u4f3c\u306e\u6a5f\u80fd\u304c\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3082\u3042\u308a\u5229\u7528\u3057\u305f\u65b9\u3082\u591a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

\u4ee5\u4e0b\u306f\u6587\u5b57\u5217\u304c\u6e21\u3055\u308c\u308b\u30682000\u30df\u30ea\u79d2\u5f8c\u306b\u300c\u5165\u529b\u5024\u306fXX\u3067\u3059\u300d\u3092\u3001\u6587\u5b57\u5217\u304c\u7a7a\u306e\u5834\u5408\u306b\u306f\u300c\u5165\u529b\u5024\u304c\u7a7a\u3067\u3059\u300d\u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8fd4\u3059\u975e\u540c\u671f\u51e6\u7406\u306e\u4f8b\u3067\u3059\u3002<\/p>\n

const hoge (value) => {\n  return new Promise((resolve, reject) => {\n    setTimeout(() => {\n      if (value) {\n        resolve(`\u5165\u529b\u5024\u306f${value}\u3067\u3059`);\n      }\n      reject('\u5165\u529b\u5024\u304c\u7a7a\u3067\u3059');\n    }, 2000);\n  });\n};\n\nhoge('\u5c71\u7530\u592a\u90ce').then(\n  response => {console.log(response)},\n  error => {console.log(error)}\n);\n\n\/\/ \u7d50\u679c\uff1a\u5165\u529b\u5024\u306f\u5c71\u7530\u592a\u90ce\u3067\u3059<\/code><\/pre>\n

\u79c1\u306f\u3001\u3053\u306ePromise\u3067\u7d50\u69cb\u6df7\u4e71\u3059\u308b\u3053\u3068\u304c\u591a\u304b\u3063\u305f\u3067\u3059\u30fb\u30fb\u30fb\u3002<\/p>\n

\u3082\u3063\u3068\u7406\u89e3\u3092\u6df1\u3081\u305f\u3044\u3068\u3044\u3046\u65b9\u306fJavaScript Promise\u306e\u672c<\/a>\u3082\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n

Proxy\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h3>\n

Proxy\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u6a19\u6e96\u7684\u306a\u64cd\u4f5c\u3092\u72ec\u81ea\u306e\u64cd\u4f5c\u3067\u5dee\u3057\u66ff\u3048\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n

\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001\u5b58\u5728\u3057\u306a\u3044\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u53d6\u5f97\u3057\u3088\u3046\u3068\u3057\u305f\u969b\u306b\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3068\u3057\u3066\u300c\uff1f\u300d\u3092\u8fd4\u3059\u3088\u3046\u306b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u307e\u3059\u3002<\/p>\n

let obj = {hoge: '\u307b\u3052', foo: '\u3075\u30fc'};\n\nconst p_obj = new Proxy(obj, {\n  get(target, prop) {\n    return prop in target ? target[prop] : '\uff1f';\n  }\n});\n\nconsole.log(p_obj.hoge);\n\/\/ \u7d50\u679c\uff1a\u307b\u3052\n\nconsole.log(p_obj.noting);\n\/\/ \u7d50\u679c\uff1a\uff1f<\/code><\/pre>\n

\u4e0a\u8a18\u3067\u306f\u3001get\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u30bf\u30fc\u30b2\u30c3\u30c8(target)\u306e\u30d7\u30ed\u30d1\u30c6\u30a3(prop)\u304c\u5b58\u5728\u3057\u3066\u3044\u308c\u3070\u3001\u305d\u306e\u5024\u3067\u3042\u308b\u300ctarget[prop]\u300d\u3092\u8fd4\u3057\u3001\u5b58\u5728\u3057\u3066\u3044\u306a\u3051\u308c\u3070\u3001\u300c\uff1f\u300d\u3092\u8fd4\u3059\u4f8b\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n

ner Proxy(target, handler);\n\ntarget\uff1a\u64cd\u4f5c\u3092\u5dee\u3057\u8fbc\u3080\u5bfe\u8c61\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\nhandler\uff1a\u30bf\u30fc\u30b2\u30c3\u30c8\u306e\u64cd\u4f5c\u3092\u5b9a\u7fa9\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/code><\/pre>\n

\u4e0a\u8a18\u306ehandler\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u5b9a\u7fa9\u3067\u304d\u307e\u3059\u3002<\/p>\n

\/\/ \u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u53d6\u5f97\nget function(target, prop, receiver) -> any\n\n\/\/ \u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u8a2d\u5b9a\nset function(target, prop, value, receiver) -> boolean\n\n\/\/ for...in\u547d\u4ee4\u306b\u3088\u308b\u5217\u6319\nenumerate function(target) -> [string]\n\n\/\/ for...of\u547d\u4ee4\u306b\u3088\u308b\u5217\u6319\niterate function(target) -> iterator\n\n\/\/ delete\u547d\u4ee4\u306b\u3088\u308b\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u524a\u9664\ndeleteProperty function(target, prop) -> boolean<\/code><\/pre>\n

\u5c11\u3057\u308f\u304b\u308a\u3065\u3089\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u4f8b\u3048\u3070\u4e0a\u8a18\u306eset\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u3001Proxy\u3092\u9069\u5fdc\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u6570\u5b57\u3092\u5165\u308c\u308b\u3068\u5024\u304c\u500d\u306b\u306a\u3063\u3066\u683c\u7d0d\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u305f\u308a\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n

let obj = {};\n\nconst p_obj = new Proxy(obj, {\n  set(target, prop, value){\n    if(typeof value === "number") {\n      value *= 2;\n    }\n    target[prop] = value;\n  }\n});\n\np_obj.a = 100;\np_obj.b = 200;\np_obj.c = "200";\n\nconsole.log(p_obj);\n\/\/ \u7d50\u679c\uff1a{a: 200, b:400, c:"200"}<\/code><\/pre>\n

\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u683c\u7d0d\u3059\u308b\u969b\u306b\u3001\u51e6\u7406\u3092\u631f\u307f\u305f\u3044\u5834\u5408\u306a\u3069\u7d50\u69cb\u3042\u308a\u305d\u3046\u306a\u306e\u3067\u4f7f\u7528\u983b\u5ea6\u306f\u9ad8\u305d\u3046\u3067\u3059\u306d\uff01<\/p>\n

Map \/ Set<\/h3>\n

ECMAScript6\u3067\u306f\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u7ba1\u7406\u3059\u308b\u305f\u3081\u306e\u5c02\u7528\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u3001Map \/ Set\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n

\u307e\u305a\u3001Map\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001\u30ad\u30fc\uff0f\u5024\u306e\u30bb\u30c3\u30c8\u3067\u30c7\u30fc\u30bf\u3092\u7ba1\u7406\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3059\u3002<\/p>\n

let obj = {};\n\n\/\/ \u30de\u30c3\u30d7\u306e\u751f\u6210\uff06\u5024\u306e\u767b\u9332\nlet m = new Map();\nm.set('hoge', '\u307b\u3052');\nm.set('foo', '\u3075\u30fc');\nm.set('piyo', '\u3074\u3088');\n\n\/\/ \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30ad\u30fc\u306b\u8a2d\u5b9a\nm.set(obj, '\u30aa\u30d6\u30b8\u30a7\u30af\u30c8');\n\n\/\/ \u5024\u306e\u53d6\u5f97\nconsole.log(m.get('hoge'));\n  \/\/ \u7d50\u679c\uff1a\u307b\u3052\nconsole.log(m.get(obj));\n  \/\/ \u7d50\u679c\uff1a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\n\n\/\/ \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u3067\u30de\u30c3\u30d7\u306b\u30a2\u30af\u30bb\u30b9\nconsole.log(m.has('hoge'));\n  \/\/ \u7d50\u679c\uff1atrue\n\n\/\/ \u30de\u30c3\u30d7\u306e\u30ad\u30fc\u3092\u5217\u6319\nfor (let key of m.keys()) {\n  console.log(key);\n}\n  \/\/ \u7d50\u679c\uff1ahoge, foo, piyo, {}\n\n\/\/ \u30de\u30c3\u30d7\u306e\u5024\u3092\u5217\u6319\nfor (let value of m.values()) {\n  console.log(value);\n}\n  \/\/ \u7d50\u679c\uff1a\u307b\u3052, \u3075\u30fc, \u3074\u3088, \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\n\n\/\/ \u30de\u30c3\u30d7\u306e\u30ad\u30fc\uff0f\u5024\u3092\u5217\u6319\nfor (let [key, value] of m) {\n  console.log(`${key}:${value}`);\n}\n  \/\/ \u7d50\u679c\uff1ahoge:\u307b\u3052\u3001foo:\u3075\u30fc\u3001piyo:\u3074\u3088\u3001[Object Object]:\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\n\n\/\/ \u30ad\u30fc\u306e\u524a\u9664\nm.delete('hoge');\n\n\/\/ \u3059\u3079\u3066\u306e\u30ad\u30fc\u3092\u524a\u9664\nm.clear();<\/code><\/pre>\n

Map\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067<\/p>\n

    \n
  • \u4efb\u610f\u306e\u5024\u3067\u30ad\u30fc\u3092\u8a2d\u5b9a\u3067\u304d\u308b<\/strong><\/li>\n
  • \u30de\u30c3\u30d7\u306e\u30b5\u30a4\u30ba\u3092size\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u7c21\u5358\u306b\u53d6\u5f97\u3067\u304d\u308b<\/strong><\/li>\n
  • \u30af\u30ea\u30fc\u30f3\u306a\u30de\u30c3\u30d7\u3092\u4f5c\u6210\u3067\u304d\u308b<\/strong><\/li>\n<\/ul>\n

    \u3068\u3044\u3046\u5229\u70b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n

    \u6b21\u306b\u3001Set\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3064\u3044\u3066\u3067\u3059\u3002
    \nSet\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u91cd\u8907\u3057\u306a\u3044\u5024\u306e\u96c6\u5408\u3092\u7ba1\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n

    \u91cd\u8907\u3057\u305f\u5024\u304c\u8ffd\u52a0\u3055\u308c\u305f\u5834\u5408\u306f\u3001\u7121\u8996\u3055\u308c\u307e\u3059\u3002<\/p>\n

    let obj = {};\n\n\/\/ \u30bb\u30c3\u30c8\u306e\u751f\u6210\uff06\u5024\u306e\u767b\u9332\nlet s = new Set();\ns.add(1);\ns.add(2);\ns.add(3);\n\n\/\/ \u91cd\u8907\u3057\u305f\u5185\u5bb9\u306f\u8ffd\u52a0\u3055\u308c\u306a\u3044\ns.add(3);\n\n\/\/ \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u578b\u3092\u767b\u9332\ns.add(obj);\n\n\/\/ \u30bb\u30c3\u30c8\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\nconsole.log(s.size);\n  \/\/ \u7d50\u679c\uff1a3\n\nconsole.log(s.has(1));\n  \/\/ \u7d50\u679c\uff1atrue\n\n\/\/ \u30bb\u30c3\u30c8\u304b\u3089\u5024\u3092\u524a\u9664\ns.delete(1);\n\n\/\/ \u30bb\u30c3\u30c8\u306e\u5024\u3092\u5217\u6319\nfor (let value of s) {\n  console.log(value);\n}\n\n\/\/ \u30bb\u30c3\u30c8\u306e\u5185\u5bb9\u3092\u30af\u30ea\u30a2\ns.clear();<\/code><\/pre>\n

    Map \/ Set\u3067\u306f\u3001Object\u578b\u3092\u306f\u3058\u3081\u4efb\u610f\u306e\u65b9\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u304c\u3001\u53c2\u7167\u578b\u3092\u30ad\u30fc\u306b\u3057\u305f\u5834\u5408\u3001get\u3084has\u30e1\u30bd\u30c3\u30c9\u3067\u306e\u53d6\u5f97\u3067\u306f\u5909\u6570obj\u3068\u30ea\u30c6\u30e9\u30eb{}\u306e\u53c2\u7167\u5148\u306f\u5225<\/strong>\u306a\u306e\u3067\u3001\u5024\u3092\u305f\u6b63\u3057\u304f\u53c2\u7167\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n

    \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u69cb\u6587<\/h2>\n

    \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u304c\u3088\u308a\u30b7\u30f3\u30d7\u30eb\u306b\u8868\u73fe\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n

    \u5909\u6570\u3092\u540c\u540d\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u8a2d\u5b9a\u3059\u308b<\/h3>\n

    \u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u540d\u524d\u3068\u3001\u305d\u306e\u5024\u304c\u540c\u540d\u306e\u5834\u5408\u306b\u5024\u306e\u6307\u5b9a\u3092\u7701\u7565\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n

    {title: title, price: price, publish: publish}\n\n\u2193\n\n{title, price, publish}<\/code><\/pre>\n

    \u30e1\u30bd\u30c3\u30c9\u3092\u5b9a\u7fa9\u3059\u308b<\/h3>\n

    \u5f93\u6765\u306f\u3001 \u540d\u524d:function(params){...}<\/code> \u306e\u3088\u3046\u306b\u95a2\u6570\u578b\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u3057\u3066\u8868\u8a18\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001ECMAScript6\u3067\u306f \u540d\u524d(params){...}<\/code> \u3068\u3044\u3046\u8868\u8a18\u304c\u8a31\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n

    let book = {\n  title: '\u30bf\u30a4\u30c8\u30eb',\n  price: 2000,\n  toString() {\n    console.log(`${this.title}:${this.price}`);\n  }\n};<\/code><\/pre>\n

    \u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3092\u52d5\u7684\u306b\u751f\u6210\u3067\u304d\u308b<\/h3>\n

    \u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3092 []<\/code> \u3067\u62ec\u308b\u3053\u3068\u3067\u3001\u5f0f\u306e\u5024\u304b\u3089\u52d5\u7684\u306b\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3092\u751f\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n

    let i = 0;\nlet data = {\n  ['hoge' + ++i]: 15,\n  ['hoge' + ++i]: 20,\n  ['hoge' + ++i]: 25,\n};\n\nconsole.log(data);\n\/\/ \u7d50\u679c\uff1a{'hoge1': 15, 'hoge2': 20, 'hoge3': 25};<\/code><\/pre>\n

    class\u547d\u4ee4<\/h3>\n

    ECMAscript6\u3067\u306f\u3001\u3044\u3088\u3044\u3088class\u547d\u4ee4\u304c\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u3084\u3063\u3068\u304b\u30fb\u30fb\u30fb\u3068\u3044\u3046\u611f\u3058\u304c\u3057\u307e\u3059( \u7b11 )<\/p>\n

    class Person {\n  constructor(name, sex) {\n    this.name = name;\n    this.sex = sex;\n  }\n  show() {\n    return `${this.name}\u306f${this.sex}\u3067\u3059\u3002`;\n  }\n}\n\nlet p = new Person('\u82b1\u5b50', '\u5973');\nconsole.log(p.show());\n\/\/ \u7d50\u679c\uff1a\u82b1\u5b50\u306f\u5973\u3067\u3059\u3002<\/code><\/pre>\n

    \u3068\u3066\u3082\u76f4\u611f\u7684\u306b\u66f8\u3051\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n

    \u305f\u3060\u3001 \u95a2\u6570\u3068\u3057\u3066\u547c\u3073\u51fa\u3059\u3053\u3068\u306f\u3067\u304d\u306a\u3044<\/code> \u5b9a\u7fa9\u524d\u306e\u547c\u3073\u51fa\u3057\u306f\u3067\u304d\u306a\u3044<\/code> \u3068\u3044\u3046\u70b9\u306b\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002<\/p>\n

    static\u4fee\u98fe\u5b50\u3084getter\u3001setter\u306a\u3069\u3082\u5229\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n

    [static\u4fee\u98fe\u5b50\u306e\u5229\u7528\u4f8b]<\/p>\n

    class Figure  {\n  static triangle(base, height) {\n    return base * height \/ 2;\n  }\n}\n\nconsole.log(Figure,triangle(10, 5));\n\/\/ \u7d50\u679c\uff1a25<\/code><\/pre>\n

    [getter\u3001setter\u306e\u5229\u7528\u4f8b]<\/p>\n

    class Person {\n  constructor(name, sex) {\n    this.name = name;\n    this.sex = sex;\n  }\n  get age() {\n    return this._age;\n  }\n  set age(value) {\n    this._age = value;\n  }\n  show() {\n    return `${this.name}\u306f${this.sex}\u3001${this.age}\u6b73\u3067\u3059\u3002`;\n  }\n}\n\nlet p = new Person('\u82b1\u5b50', '\u5973');\np.age = 10;\nconsole.log(p.show());\n\/\/ \u7d50\u679c\uff1a\u82b1\u5b50\u306f\u5973\u300110\u6b73\u3067\u3059\u3002<\/code><\/pre>\n

    \u203bECMAscript6\u3067\u306f\u3001class\u30d6\u30ed\u30c3\u30af\u306e\u4e2d\u3067 let age = 10;<\/code> \u306e\u3088\u3046\u306a\u3001 \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044<\/strong> \u70ba\u3001\u4e0a\u8a18\u306egetter\u3001setter\u3092\u5229\u7528\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n

    extends\u30ad\u30fc\u30ef\u30fc\u30c9<\/h3>\n

    extends\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u65e2\u5b58\u306eclass\u3092\u8efd\u50b7\u3057\u3066\u30b5\u30d6\u30af\u30e9\u30b9\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n

    class Person {\n  constructor(name, sex) {\n    this.name = name;\n    this.sex = sex;\n  }\n  show() {\n    return `${this.name}\u306f${this.sex}\u3067\u3059\u3002`;\n  }\n}\n\nclass BusinessPerson extends Person {\n  constructor(name, sex, clazz) {\n    super(name, sex);\n    this.clazz = clazz;\n  }\n  show() {\n    return `${super.show()}\u3000\u5f79\u8077\u306f${this.clazz}\u3067\u3059\u3002`;\n  }\n}\n\nlet bp = new BusinessPerson('\u82b1\u5b50', '\u5973', '\u4e3b\u4efb');\nconsole.log(bp.show());\n\/\/ \u7d50\u679c\uff1a\u82b1\u5b50\u306f\u5973\u3067\u3059\u3002\u3000\u5f79\u8077\u306f\u4e3b\u4efb\u3067\u3059\u3002<\/code><\/pre>\n

    ECMAScript6\u3067\u306f\u3001Array \/ Date \/ Error\u306a\u3069\u306e\u7d44\u307f\u8fbc\u307f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092extends\u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u7d99\u627f\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n

    \u72ec\u81ea\u306e\u4f8b\u5916\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5b9f\u88c5\u3057\u305f\u3044\u5834\u5408\u306a\u3069\u4fbf\u5229\u305d\u3046\u3067\u3059\u306d(\u309c\u309c)<\/p>\n


    \n

    \u3044\u304b\u304c\u3067\u3057\u305f\u3067\u3057\u3087\u3046\u304b\u3002
    \n\u3053\u3046\u3057\u3066\u307e\u3068\u3081\u3066\u307f\u308b\u3068\u3001\u307e\u3060\u307e\u3060\u5b9f\u52d9\u3067\u751f\u304b\u305b\u3066\u3044\u306a\u3044\u90e8\u5206\u306a\u3069\u3082\u3061\u3089\u307b\u3089\u3042\u308a\u500b\u4eba\u7684\u306b\u3082\u3053\u3046\u3057\u3066\u52c9\u5f37\uff06\u307e\u3068\u3081\u308b\u3053\u3068\u3067\u3088\u3044\u52c9\u5f37\u306b\u306a\u308a\u307e\u3057\u305f\uff01<\/p>\n

    \u4eca\u56de\u3067ECMAScript6\u306b\u3064\u3044\u3066\u306f\u7d42\u308f\u308a\u3068\u306a\u308a\u307e\u3059\u3002
    \n\u6b21\u56de\u304b\u3089\u306f\u3001Redux\u306e\u5b66\u7fd2\u306b\u5165\u3063\u3066\u3044\u304d\u307e\u3059\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

    \u524d\u56de\u306b\u5f15\u304d\u7d9a\u304dECMAScript\u3092\u307e\u3068\u3081\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u4eca\u56de\u306f\u524d\u56de\u7d39\u4ecb\u3067\u304d\u306a\u304b\u3063\u305f\u3001\u95a2\u6570 \u7d44\u307f\u8fbc\u307f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u69cb\u6587 \u306b\u3064\u3044\u3066\u3067\u3059\u3002 \u95a2\u6570 \u30c7\u30d5\u30a9\u30eb\u30c8\u5024 \u5f93\u6765\u306eJavaScript\u3067\u306f\u3001\u5f15\u6570\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u305a\u3001\u5f15\u6570\u304c\u6e21\u305b\u3055\u308c\u3066\u3044\u308b\u304b\u306e\u30c1\u30a7\u30c3\u30af\u3092\u3057\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3068\u3044\u3063\u305f\u51e6\u7406\u3092\u66f8\u304b\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001ECMAScript6\u3067\u306f\u5f15\u6570\u306b\u30c7\u30d5\u30a9 […]<\/p>\n","protected":false},"author":1,"featured_media":684,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[438],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/371"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=371"}],"version-history":[{"count":1,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/371\/revisions"}],"predecessor-version":[{"id":3281,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/371\/revisions\/3281"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}