{"id":14235,"date":"2019-05-27T09:00:35","date_gmt":"2019-05-27T00:00:35","guid":{"rendered":"https:\/\/www.agent-grow.com\/self20percent\/?p=14235"},"modified":"2019-05-23T08:32:44","modified_gmt":"2019-05-22T23:32:44","slug":"js-destructuring-assignment","status":"publish","type":"post","link":"https:\/\/www.agent-grow.com\/self20percent\/2019\/05\/27\/js-destructuring-assignment\/","title":{"rendered":"JavaScript \u3067\u3001\u77e5\u3063\u3066\u3044\u308b\u3068\u3061\u3087\u3063\u3068\u4fbf\u5229\u306a\u300c\u5206\u5272\u4ee3\u5165\u300d\u306e\u8a71"},"content":{"rendered":"<h1>\u4eca\u56de\u306f\u5206\u5272\u4ee3\u5165\u3092\u3084\u308b\u3088\uff01<\/h1>\n<p>2015 \u5e74\u306b\u6a19\u6e96\u5316\u3055\u308c\u305f\u3001 JavaScript \u306e\u6bd4\u8f03\u7684\u65b0\u3057\u3044\u4ed5\u69d8\u3068\u3057\u3066\u3001<br \/>\n\u300c\u5206\u5272\u4ee3\u5165\u300d\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u899a\u3048\u3066\u304a\u304f\u3068\u5272\u3068\u4fbf\u5229\u306a\u306e\u3067\u3059\u304c\u3001\u3042\u307e\u308a\u4f7f\u308f\u308c\u3066\u3044\u306a\u3044\u6c17\u304c\u3059\u308b\u306e\u3067\u3001<br \/>\n\u4eca\u56de\u306f\u3053\u306e\u3001\u3061\u3087\u3063\u3068\u4fbf\u5229\u306a\u5206\u5272\u4ee3\u5165\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h1>\u6700\u521d\u306b\u3001\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u30d6\u30e9\u30a6\u30b6\u78ba\u8a8d<\/h1>\n<p>\u5206\u5272\u4ee3\u5165\u306f\u65b0\u3057\u3081\u306e\u4ed5\u69d8\u306a\u306e\u3067\u3001\u5404\u30d6\u30e9\u30a6\u30b6\u304c\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u3044\u3064\u3082\u306e <a href=\"https:\/\/caniuse.com\/#search=destructuring%20assignment\" rel=\"noopener noreferrer\" target=\"_blank\">Can I use<\/a> \u3067\u8abf\u3079\u3066\u307f\u308b\u3068\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"14236\" data-permalink=\"https:\/\/www.agent-grow.com\/self20percent\/2019\/05\/27\/js-destructuring-assignment\/%e7%84%a1%e9%a1%8c-71\/\" data-orig-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/05\/0d40a5e4a645fc6b96e767d64ac0878e-3.png\" data-orig-size=\"800,578\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\u7121\u984c\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/05\/0d40a5e4a645fc6b96e767d64ac0878e-3.png\" src=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/05\/0d40a5e4a645fc6b96e767d64ac0878e-3-300x217.png\" alt=\"\" width=\"300\" height=\"217\" class=\"alignnone size-medium wp-image-14236\" srcset=\"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/05\/0d40a5e4a645fc6b96e767d64ac0878e-3-300x217.png 300w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/05\/0d40a5e4a645fc6b96e767d64ac0878e-3-768x555.png 768w, https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/05\/0d40a5e4a645fc6b96e767d64ac0878e-3.png 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>IE \u4ee5\u5916\u306e\u4e3b\u8981\u30d6\u30e9\u30a6\u30b6\u3067\u306f\u5bfe\u5fdc\u3055\u308c\u3066\u3044\u307e\u3059\u306d\uff01<br \/>\n\u6700\u60aa\u3001IE \u3067\u3082\u4f7f\u3044\u305f\u3044\u3093\u3060\u3051\u3069\u3063\u3066\u8a71\u306b\u306a\u308c\u3070\u3001\u305d\u306e\u3042\u305f\u308a <a href=\"https:\/\/babeljs.io\/\" rel=\"noopener noreferrer\" target=\"_blank\">babel<\/a> \u3068\u304b\u4f7f\u3048\u3070<br \/>\nIE \u3067\u3082\u8aad\u3081\u308b\u3088\u3046\u306b\u3046\u307e\u304f\u5909\u63db\u3057\u3066\u304f\u308c\u308b\u304b\u3089\u3044\u3044\u3067\u3059\u306d\u3002<\/p>\n<h1>\u5206\u5272\u4ee3\u5165\uff01\u57fa\u672c\u306e\u4f7f\u3044\u65b9<\/h1>\n<h2>\u914d\u5217<\/h2>\n<p>\u3055\u3066\u3001\u5206\u5272\u4ee3\u5165\u306e\u5177\u4f53\u7684\u306a\u8a71\u306b\u5165\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u5206\u5272\u4ee3\u5165\u306f\u4e00\u8a00\u3067\u8a00\u3048\u3070\u3001<br \/>\n\u914d\u5217\u3084\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5909\u6570\u306b\u4ee3\u5165\u3059\u308b\u3068\u304d\u306b\u3001\u305d\u308c\u3092\u30d0\u30e9\u3057\u3066\u5165\u308c\u3066\u304f\u308c\u308b\u3068\u3044\u3046\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u5206\u5272\u4ee3\u5165\u306a\u3057\u3067\u66f8\u304f\u3068<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst ary = &#x5B;3, 5];\n\nconst a = ary&#x5B;0];  \/\/ 3\nconst b = ary&#x5B;1];  \/\/ 5\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u306e\u51e6\u7406\u3002<br \/>\n\u3053\u308c\u306f\u3001\u307e\u305a ary \u5909\u6570\u306b <code>[3, 5]<\/code> \u306e\u914d\u5217\u304c\u4ee3\u5165\u3055\u308c\u307e\u3059\u3088\u306d\u3002<br \/>\n(const \u306f\u5909\u6570\u5b9a\u7fa9\u3067\u3059\u306d\uff09<br \/>\n\u3067\u3001\u914d\u5217\u306e 0 \u756a\u76ee\u3001 1 \u756a\u76ee\u3092\u305d\u308c\u305e\u308c a, b \u306e\u5909\u6570\u306b\u4ee3\u5165\u3057\u3066\u3044\u308b\u3001\u3068\u3044\u3046\u6d41\u308c\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3067\u3001 a \u306b\u306f 3 \u304c\u3001b \u306b\u306f 5 \u304c\u4ee3\u5165\u3055\u308c\u307e\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u3092\u5206\u5272\u4ee3\u5165\u3092\u4f7f\u3063\u3066\u66f8\u304f\u3068\u2026<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst ary = &#x5B;3, 5];\n\nconst &#x5B;a, b] = ary;\n\/\/ a = 3\n\/\/ b = 5\n<\/pre>\n<p>\u306a\u3093\u3068\uff01\u5b9a\u7fa9\u5074\u306b\u3082\u914d\u5217\u307f\u305f\u3044\u306a <code>[a, b]<\/code> \u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u306d\uff01<br \/>\n\u3053\u3093\u306a\u611f\u3058\u3067\u5909\u6570\u5b9a\u7fa9\u5074\u306b\u66f8\u304f\u3053\u3068\u3067\u3001\u4ee3\u5165\u3059\u308b\u914d\u5217 ary \u306b\u3042\u308b\u3001<br \/>\n\u4f4d\u7f6e\u304c\u5bfe\u5fdc\u3059\u308b\u5024\u304c a, b \u306b\u76f4\u63a5\u5165\u3063\u3066\u3044\u304f\u306e\u3067\u3059\u306d\u3002<\/p>\n<p>\u5bfe\u5fdc\u3059\u308b\u5f62\u3067\u3042\u308c\u3070\u3088\u3044\u306e\u3067\u3001\u3053\u3093\u306a\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst ary = &#x5B;3, &#x5B;6, 9]];\n\nconst &#x5B;a, &#x5B;b, c]] = ary;\n\/\/ a = 3\n\/\/ b = 6\n\/\/ c = 9\n<\/pre>\n<p>\u5165\u308c\u5b50\u306b\u306a\u3063\u3066\u3044\u308b\u914d\u5217\u306b\u3064\u3044\u3066\u3082\u3001\u3046\u307e\u3044\u3053\u3068\u5c55\u958b\u3057\u3066\u3084\u3063\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<h2>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h2>\n<p>\u3053\u306e\u5206\u5272\u4ee3\u5165\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3082\u540c\u3058\u3088\u3046\u306b\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst obj = {a: 3, b: 6};\n\nconst {a, b} = obj;\n\/\/ a = 3\n\/\/ b = 6\n<\/pre>\n<p>\u914d\u5217\u306e\u5834\u5408\u306f\u5909\u6570\u3092\u66f8\u304f\u5834\u6240\u3092\u3001\u914d\u5217\u306e\u5024\u306e\u5834\u6240\u3092\u5408\u308f\u305b\u307e\u3057\u305f\u304c\u3001<br \/>\n\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5834\u5408\u306f\u3001\u4ee3\u5165\u3057\u305f\u3044\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u540d\u524d\u3092\u5408\u308f\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst obj = {a: 3, b: 6};\n\nconst {b, a} = obj;\n\/\/ a = 3\n\/\/ b = 6\n<\/pre>\n<p>\u3064\u307e\u308a\u3001\u3053\u3046\u3044\u3046\u3053\u3068\u3092\u3057\u305f\u3089\u3001\u914d\u5217\u306e\u5834\u5408\u306f\u5024\u304c\u5165\u308c\u66ff\u308f\u3063\u3066\u5165\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u304c\u3001<br \/>\n\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5834\u5408\u306f\u540d\u524d\u304c\u4e00\u81f4\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u306b\u5024\u3092\u5165\u308c\u308b\u306e\u3067\u3001<br \/>\n\u5148\u307b\u3069\u3068\u540c\u3058\u7d50\u679c\u3068\u306a\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u914d\u5217\u306e\u65b9\u3067\u306f\u3067\u304d\u306a\u3044\u306e\u3067\u3059\u304c\u3001<br \/>\n\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307b\u3046\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306e\u8a2d\u5b9a\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst obj = {a: 3, b: 6};\n\nconst {a = 10, c = 10} = obj;\n\/\/ a = 3\n\/\/ c = 10 (c \u306f obj \u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u3057\u3066\u5b58\u5728\u3057\u306a\u3044\u306e\u3067\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u4f7f\u7528\u3055\u308c\u308b)\n<\/pre>\n<h1>\u4fbf\u5229\u306a\u4f7f\u3044\u65b9<\/h1>\n<h2>\u6b63\u898f\u8868\u73fe\u3067\u306e\u89e3\u6790\u7d50\u679c\u304b\u3089\u306e\u5024\u306e\u53d6\u308a\u51fa\u3057<\/h2>\n<p>JavaScript \u3067\u306f\u6b63\u898f\u8868\u73fe\u306b\u30de\u30c3\u30c1\u3057\u305f\u7d50\u679c\u3092\u914d\u5217\u3068\u3057\u3066\u8fd4\u3057\u3066\u304d\u3066\u304f\u308c\u307e\u3059\u3088\u306d\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst parsedURL = \/^(\\w+)\\:\\\/\\\/(&#x5B;^\\\/]+)\\\/(.*)$\/.exec(\u2019https:\/\/example.com\/path\u2019);\nconst &#x5B;, protocol, host, path] = parsedURL;\n<\/pre>\n<p>parsedURL \u306b\u306f <code>[\u2019https:\/\/example.com\/path\u2019, \u2019https\u2019, \u2019example.com\u2019, \u2019path\u2019]<\/code> \u304b\u5165\u3063\u3066\u304d\u307e\u3059\u304b\u3089\u3001<br \/>\n\u3053\u308c\u3089\u3092\u4e00\u3064\u305a\u3064\u5909\u6570\u4ee3\u5165\u3059\u308b\u3088\u308a\u306f\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u3072\u3068\u307e\u3068\u3081\u306b\u3057\u3066\u3057\u3066\u3057\u307e\u3063\u305f\u65b9\u304c\u30b9\u30de\u30fc\u30c8\u3067\u3059\u3088\u306d\u3002<\/p>\n<h2>\u5024\u306e\u5165\u308c\u66ff\u3048<\/h2>\n<p>\uff08\u6700\u8fd1\u3067\u306f\u3042\u307e\u308a\u306a\u3044\u3067\u3059\u304c\uff09\u4f8b\u3048\u3070\u3001\u5909\u6570 a \u3068 b \u306e\u5024\u3092\u5165\u308c\u66ff\u3048\u308b\u3068\u304d\u306f<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet swap = a;\nlet a = b;\nlet b = swap;\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u4eee\u7f6e\u304d\u306e\u5909\u6570\u3092\u7528\u610f\u3057\u3066\u5b9f\u65bd\u3057\u307e\u3059\u3088\u306d\uff1f<\/p>\n<p>\u3067\u3082\u3001\u4eca\u56de\u306e\u5206\u5272\u4ee3\u5165\u3092\u4f7f\u3046\u3068<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;a, b] = &#x5B;b, a]\n<\/pre>\n<p>\u305d\u308c\u305e\u308c\u306e\u4f4d\u7f6e\u306e\u5024\u3092\u4ee3\u5165\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u4e00\u884c\u3067\u66f8\u3044\u3066\u3057\u307e\u3046\u3053\u3068\u3082\u3067\u304d\u308b\u306e\u3067\u3059\u306d\uff01<br \/>\n\u305d\u3093\u306a\u306b\u4f7f\u3046\u983b\u5ea6\u306f\u306a\u3044\u3067\u3059\u304c\u3001\u899a\u3048\u3066\u304a\u304f\u3068\u9762\u767d\u3044\u30bf\u30a4\u30d7\u306e\u5c0f\u30cd\u30bf\u3067\u3059\u3002<\/p>\n<h2>\u95a2\u6570\u306e\u5f15\u6570\u3092\u5c55\u958b\u3059\u308b<\/h2>\n<p>\u6b63\u76f4\u4eca\u56de\u3053\u308c\u3092\u66f8\u304d\u305f\u304b\u3063\u305f\u304c\u305f\u3081\u306b\u3053\u306e\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u308b\u304f\u3089\u3044\u306a\u3001<br \/>\n\u307f\u3093\u306a\u306b\u77e5\u3063\u3066\u3082\u3089\u3044\u305f\u3044\u4fbf\u5229\u306a\u66f8\u304d\u65b9\u3002<\/p>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst {b, a} = obj;\n<\/pre>\n<p>\u307f\u305f\u3044\u306a\u611f\u3058\u3067\u5c55\u958b\u3059\u308b\u3068\u3001\u540c\u3058\u540d\u524d\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5909\u6570\u306b\u5c55\u958b\u3057\u3066\u304f\u308c\u308b\u3068\u66f8\u304d\u307e\u3057\u305f\u304c\u3001<br \/>\n\u3053\u308c\u306f\u95a2\u6570\u306e\u5f15\u6570\u306e\u3068\u3053\u308d\u3067\u540c\u3058\u3088\u3046\u306b\u4f7f\u3048\u3066\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/\/ \u5f15\u6570\u53d7\u3051\u53d6\u308a\u306e\u3068\u3053\u308d\u3067\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5c55\u958b\nconst sum = function({a, b}) {\n  return a + b;\n}\n\nconst obj = {a: 3, b: 4};\n\nsum(obj); \/\/ 7 \u304c\u8fd4\u3063\u3066\u304f\u308b\n<\/pre>\n<p>\u3053\u3093\u306a\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u306e\u4f55\u304c\u4fbf\u5229\u3063\u3066\u3001\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u304b\u3092\u4f7f\u3063\u3066\u308b\u3068\u3001<br \/>\n\u4e00\u3064\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3044\u308d\u3044\u308d\u306a\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u683c\u7d0d\u3055\u308c\u3066\u4e00\u3064\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u3088\u304f\u3042\u308a\u307e\u3059\u304c\u3001<\/p>\n<ul>\n<li>\u95a2\u6570\u3092\u4f7f\u3046\u5074\u306f\u305d\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3089\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u53d6\u308a\u51fa\u3055\u305a\u305d\u306e\u307e\u307e\u6e21\u305b\u308b<\/li>\n<li>\u95a2\u6570\u5074\u306f\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u5185\u306e\u4e0d\u5fc5\u8981\u306a\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u89e6\u308b\u3053\u3068\u306a\u304f\u51e6\u7406\u304c\u3067\u304d\u308b<\/li>\n<\/ul>\n<p>\u3068\u3044\u3046\u3053\u3068\u306a\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u3082\u3057\u3001\u307e\u3060\u4f7f\u3063\u305f\u3053\u3068\u304c\u306a\u3051\u308c\u3070\u3001<br \/>\n\u5b9f\u969b\u306b\u4f7f\u3063\u3066\u307f\u3066\u3082\u3089\u3063\u305f\u3089\u3001\u305d\u306e\u4fbf\u5229\u3055\u306b\u9a5a\u304f\u3053\u3068\u9593\u9055\u3044\u306a\u3057\u3067\u3059\u3002<\/p>\n<h2>\u53cd\u5fa9\u51e6\u7406\u306e\u5909\u6570\u3082\u5c55\u958b\u3059\u308b<\/h2>\n<p>\u95a2\u6570\u306e\u5f15\u6570\u3068\u540c\u3058\u3088\u3046\u306b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst ary = &#x5B;\n  {name: \u2019hoge\u2019, age: 10},\n  {name: \u2019fuga\u2019, age: 12},\n];\n\nfor ({name} of ary) {\n  console.log(name); \/\/ hoge fuga\n}\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u4f7f\u3048\u3070\u3001\u5909\u6570\u3092\u5c55\u958b\u3057\u305f\u72b6\u614b\u3067\u30eb\u30fc\u30d7\u306e\u4e2d\u3067\u4f7f\u3048\u307e\u3059\u3002<br \/>\n\u2026\u304c\u3001\u95a2\u6570\u306e\u5f15\u6570\u307b\u3069\u306e\u4fbf\u5229\u6027\u306f\u7121\u3044\u304b\u306a\u2026<\/p>\n<h2>\u5909\u6570\u540d\u306e\u5909\u66f4<\/h2>\n<p>\u3053\u3053\u304b\u3089\u306f\u591a\u5206\u4f7f\u308f\u306a\u3044\u3001\u3068\u3044\u3046\u304b\u53ef\u8aad\u6027\u304c\u843d\u3061\u308b\u306e\u3067\u4f7f\u3044\u3069\u3053\u308d\u3092\u8003\u3048\u3066\u3082\u3089\u3046\u5fc5\u8981\u304c\u3042\u308b\u30cd\u30bf\u3067\u3059\u3002<br \/>\n\u79c1\u306f\u4e00\u5ea6\u3082\u4f7f\u3063\u305f\u3053\u3068\u306a\u3044\u3067\u3059\u304c\u3001\u4e00\u5fdc\u3053\u3093\u306a\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3088\u3068\u3044\u3046\u304a\u8a71\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst obj = {a: 3, b: 6};\n\nconst {a: anotherName} = obj;\n\nconsole.log(anotherName); \/\/ 3\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u5143\u3005\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d\u306e\u5f8c\u308d\u306b\u3001\u30b3\u30ed\u30f3\u3068\u5225\u540d\u3092\u8a18\u8f09\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001<br \/>\n\u5225\u540d\u306e\u65b9\u3092\u5909\u6570\u540d\u3068\u3057\u3066\u5024\u3092\u4ee3\u5165\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u4f8b\u3060\u3068\u3001\u5143\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3067\u3042\u308b a \u306e\u5909\u6570\u306f\u4f5c\u6210\u3055\u308c\u306a\u3044\u306e\u3067\u3054\u6ce8\u610f\u3002<\/p>\n<p>\u5148\u307b\u3069\u306e\u95a2\u6570\u306e\u5f15\u6570\u306e\u3068\u3053\u308d\u3067\u5c55\u958b\u3059\u308b\u6280\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u3001<br \/>\n\u95a2\u6570\u306e\u4e2d\u306b\u3001\u597d\u304d\u306a\u540d\u524d\u3067\u5909\u6570\u3092\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u2026<br \/>\n\u304c\u3001\u5927\u62b5\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3067\u4e8b\u8db3\u308a\u308b\u306e\u3067\u3001\u3084\u3063\u3071\u308a\u307b\u307c\u4f7f\u308f\u306a\u3044\u304b\u306a\u3002<\/p>\n<h2>\u30c7\u30d5\u30a9\u30eb\u30c8\u95a2\u6570<\/h2>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5206\u5272\u4ee3\u5165\u3067\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u8a2d\u5b9a\u3067\u304d\u308b\u3068\u3044\u3046\u8a71\u3092\u6700\u521d\u306e\u65b9\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3042\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306a\u306e\u3067\u3059\u304c\u3001\u672c\u5f53\u306f\u5358\u7d14\u306a\u5024\u3060\u3051\u3067\u306a\u304f\u3001\u95a2\u6570\u3082\u6307\u5b9a\u3067\u304d\u3066\u3057\u307e\u3046\u306e\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst obj = {a: 3, b: 6};\n\nconst def = function() {\n  return 10;\n}\n\nconst {c = def()} = obj;\n\nconsole.log(c); \/\/ 10\n<\/pre>\n<p>\u3067\u304d\u307e\u3059\u3002\u3067\u304d\u307e\u3059\u304c\u2026<br \/>\n\u3053\u3046\u3044\u3046\u8a33\u306e\u5206\u304b\u3089\u306a\u3044\u3053\u3068\u3092\u3057\u59cb\u3081\u308b\u3068\u3001\u9ed2\u9b54\u8853\u306b\u5165\u9580\u3057\u3066\u3057\u307e\u3046\u306e\u3067\u3084\u3081\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u4e00\u5fdc\u88dc\u8db3\u3057\u3066\u304a\u304f\u3068\u3001<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306e\u8a2d\u5b9a\u6642\u70b9\u3067 () \u3092\u3064\u3051\u3066\u3044\u307e\u3059\u304c\u3001<br \/>\n\u4eca\u56de\u306e\u5834\u5408\u3067\u8a00\u3048\u3070 a \u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u53c2\u7167\u3059\u308b\u306a\u3069\u306e\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u4f7f\u7528\u3055\u308c\u306a\u3044\u5834\u5408\u306b\u306f<br \/>\n\u3053\u306e\u95a2\u6570\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u2026\u3068\u3044\u3046\u3053\u3068\u306f\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3068\u304d\u306e\u307f\u5b9f\u884c\u3055\u308c\u308b\u95a2\u6570\u306a\u3093\u304b\u304b\u3051\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst obj = {a: 3, b: 6};\n\nconst {c = (() =\uff1e console.log(\u2019c \u306f\u5b9a\u7fa9\u3055\u308c\u3066\u306a\u3044\u3088\uff01\u2019))()} = obj;\n<\/pre>\n<p>\u8aad\u3080\u4eba\u304b\u3089\u3057\u305f\u3089\u3001\u3048\u3052\u3064\u306a\u3044\u306e\u3067\u3084\u3081\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<h1>\u307e\u3068\u3081<\/h1>\n<p>\u5206\u5272\u4ee3\u5165\u306e\u53ef\u80fd\u6027\u3092\u8272\u3005\u3068\u611f\u3058\u3066\u3044\u305f\u3060\u3051\u305f\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u306e\u306f\u30cd\u30bf\u3068\u3057\u3066\u3057\u304b\u4f7f\u3048\u306a\u3044\u3067\u3059\u304c\u3001<br \/>\n\u95a2\u6570\u306e\u5f15\u6570\u3067\u5206\u5272\u4ee3\u5165\u306f\u672c\u5f53\u306b\u4fbf\u5229\u306a\u306e\u3067\u7686\u3055\u3093\u4f7f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306f\u5206\u5272\u4ee3\u5165\u3092\u3084\u308b\u3088\uff01 2015 \u5e74\u306b\u6a19\u6e96\u5316\u3055\u308c\u305f\u3001 JavaScript \u306e\u6bd4\u8f03\u7684\u65b0\u3057\u3044\u4ed5\u69d8\u3068\u3057\u3066\u3001 \u300c\u5206\u5272\u4ee3\u5165\u300d\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002 \u899a\u3048\u3066\u304a\u304f\u3068\u5272\u3068\u4fbf\u5229\u306a\u306e\u3067\u3059\u304c\u3001\u3042\u307e\u308a\u4f7f\u308f\u308c\u3066\u3044\u306a\u3044\u6c17\u304c\u3059\u308b\u306e\u3067\u3001 \u4eca\u56de\u306f\u3053\u306e [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":14242,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[45],"class_list":["post-14235","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-javascript"],"jetpack_featured_media_url":"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/05\/850c7612116999490846136e772ab7fd-1.png","jetpack_shortlink":"https:\/\/wp.me\/p7Bq4F-3HB","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/14235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/comments?post=14235"}],"version-history":[{"count":0,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/14235\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media\/14242"}],"wp:attachment":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media?parent=14235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/categories?post=14235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/tags?post=14235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}