{"id":864,"date":"2025-08-05T16:49:00","date_gmt":"2025-08-05T07:49:00","guid":{"rendered":"https:\/\/nexive.tech\/?p=864"},"modified":"2025-08-05T16:49:00","modified_gmt":"2025-08-05T07:49:00","slug":"%e3%80%90%e3%82%b5%e3%82%af%e3%83%83%e3%81%a8%e8%a7%a3%e8%aa%ac%e3%80%91javascript-%e3%82%b9%e3%83%97%e3%83%ac%e3%83%83%e3%83%89%e6%a7%8b%e6%96%87","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=864","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011JavaScript \u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>JavaScript\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\uff08<code>...<\/code>\uff09\u3068\u6b8b\u4f59\u5f15\u6570\uff08rest parameter\uff09\u306e\u57fa\u672c\u69cb\u6587\u3092\u6574\u7406<\/li>\n\n\n\n<li>\u914d\u5217\u30fb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u64cd\u4f5c\u3001\u95a2\u6570\u5b9a\u7fa9\u3067\u306e\u5177\u4f53\u7684\u306a\u6d3b\u7528\u30b7\u30fc\u30f3\u3092\u7d39\u4ecb<\/li>\n\n\n\n<li>\u5b9f\u52d9\u3067\u3042\u308a\u304c\u3061\u306a\u8aa4\u7528\u3084\u6df7\u540c\u30dd\u30a4\u30f3\u30c8\u3092\u89e3\u8aac<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\u3068\u6b8b\u4f59\u5f15\u6570\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>JavaScript\u3067\u306f\u3001<code>...<\/code>\uff08\u30c9\u30c3\u30c83\u3064\uff09\u3092\u4f7f\u3063\u305f\u69cb\u6587\u304c2\u7a2e\u985e\u5b58\u5728\u3057\u307e\u3059\u30021\u3064\u306f<strong>\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\uff08spread syntax\uff09<\/strong>\u3001\u3082\u30461\u3064\u306f**\u6b8b\u4f59\u5f15\u6570\uff08rest parameter\uff09**\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\u306f\u3001\u914d\u5217\u3084\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5c55\u958b\u3057\u3066\u8981\u7d20\u3092\u53d6\u308a\u51fa\u3059\u969b\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002\u4ee3\u8868\u7684\u306a\u7528\u9014\u306f\u3001\u914d\u5217\u306e\u30b3\u30d4\u30fc\u3001\u7d50\u5408\u3001\u95a2\u6570\u547c\u3073\u51fa\u3057\u6642\u306e\u5f15\u6570\u5c55\u958b\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4e00\u65b9\u3001\u6b8b\u4f59\u5f15\u6570\u306f\u95a2\u6570\u5b9a\u7fa9\u3067\u4f7f\u308f\u308c\u3001\u53ef\u5909\u9577\u306e\u5f15\u6570\u30921\u3064\u306e\u914d\u5217\u3068\u3057\u3066\u53d7\u3051\u53d6\u308b\u624b\u6bb5\u3067\u3059\u3002\u3069\u3061\u3089\u3082\u69cb\u6587\u4e0a\u306f <code>...<\/code> \u3092\u4f7f\u3044\u307e\u3059\u304c\u3001<strong>\u4f7f\u7528\u4f4d\u7f6e\u3068\u76ee\u7684\u304c\u7570\u306a\u308a\u307e\u3059<\/strong>\u3002<\/p>\n\n\n\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\u3068\u6b8b\u4f59\u5f15\u6570\u306f\u3069\u3061\u3089\u3082ES6\u4ee5\u964d\u3067\u5c0e\u5165\u3055\u308c\u3066\u304a\u308a\u3001\u53ef\u8aad\u6027\u3068\u67d4\u8edf\u6027\u3092\u9ad8\u3081\u308b\u305f\u3081\u306b\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3002\u5b9f\u52d9\u3067\u306f\u3001API\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u52a0\u5de5\u3084\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30d0\u30a4\u30f3\u30c9\u3001React\u306eProps\u5c55\u958b\u306a\u3069\u591a\u304f\u306e\u5834\u9762\u3067\u5229\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u8a73\u7d30\u89e3\u8aac<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u914d\u5217\u306e\u30b3\u30d4\u30fc\u30fb\u7d50\u5408\uff08\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\uff09<\/h3>\n\n\n\n<p>\u914d\u5217\u3092\u6d45\u304f\u30b3\u30d4\u30fc\u3057\u305f\u308a\u3001\u8907\u6570\u306e\u914d\u5217\u3092\u7d50\u5408\u3059\u308b\u5834\u9762\u3067\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">JavaScript<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>const original = &#91;1, 2, 3&#93;;\nconst copy = &#91;...original&#93;; \/\/ \u6d45\u3044\u30b3\u30d4\u30fc\nconst extended = &#91;...original, 4, 5&#93;; \/\/ \u8981\u7d20\u306e\u8ffd\u52a0\n\nconsole.log(copy);     \/\/ &#91;1, 2, 3&#93;\nconsole.log(extended); \/\/ &#91;1, 2, 3, 4, 5&#93;\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">original<\/span><span style=\"color: #D4D4D4\"> = &#91;<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">2<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">3<\/span><span style=\"color: #D4D4D4\">&#93;;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">copy<\/span><span style=\"color: #D4D4D4\"> = &#91;...<\/span><span style=\"color: #9CDCFE\">original<\/span><span style=\"color: #D4D4D4\">&#93;; <\/span><span style=\"color: #6A9955\">\/\/ \u6d45\u3044\u30b3\u30d4\u30fc<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">extended<\/span><span style=\"color: #D4D4D4\"> = &#91;...<\/span><span style=\"color: #9CDCFE\">original<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">4<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">5<\/span><span style=\"color: #D4D4D4\">&#93;; <\/span><span style=\"color: #6A9955\">\/\/ \u8981\u7d20\u306e\u8ffd\u52a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">console<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">copy<\/span><span style=\"color: #D4D4D4\">);     <\/span><span style=\"color: #6A9955\">\/\/ &#91;1, 2, 3&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">console<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">extended<\/span><span style=\"color: #D4D4D4\">); <\/span><span style=\"color: #6A9955\">\/\/ &#91;1, 2, 3, 4, 5&#93;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u95a2\u6570\u5f15\u6570\u3078\u306e\u5c55\u958b\uff08\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\uff09<\/h3>\n\n\n\n<p>\u5f15\u6570\u306e\u914d\u5217\u3092\u5c55\u958b\u3057\u3066\u95a2\u6570\u306b\u6e21\u3057\u305f\u3044\u5834\u5408\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">JavaScript<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>function sum(a, b, c) {\n  return a + b + c;\n}\n\nconst nums = &#91;10, 20, 30&#93;;\nconsole.log(sum(...nums)); \/\/ 60\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">sum<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">a<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">b<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">c<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">a<\/span><span style=\"color: #D4D4D4\"> + <\/span><span style=\"color: #9CDCFE\">b<\/span><span style=\"color: #D4D4D4\"> + <\/span><span style=\"color: #9CDCFE\">c<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">nums<\/span><span style=\"color: #D4D4D4\"> = &#91;<\/span><span style=\"color: #B5CEA8\">10<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">20<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">30<\/span><span style=\"color: #D4D4D4\">&#93;;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">console<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #DCDCAA\">sum<\/span><span style=\"color: #D4D4D4\">(...<\/span><span style=\"color: #9CDCFE\">nums<\/span><span style=\"color: #D4D4D4\">)); <\/span><span style=\"color: #6A9955\">\/\/ 60<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u95a2\u6570\u306e\u6b8b\u4f59\u5f15\u6570\u306e\u53d6\u5f97\uff08rest parameter\uff09<\/h3>\n\n\n\n<p>\u53ef\u5909\u9577\u306e\u5f15\u6570\u3092\u53d7\u3051\u53d6\u308b\u95a2\u6570\u3067\u3001\u5f15\u6570\u30921\u3064\u306e\u914d\u5217\u3068\u3057\u3066\u53d7\u3051\u53d6\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">JavaScript<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>function logAll(first, ...others) {\n  console.log(\"first:\", first);\n  console.log(\"others:\", others);\n}\n\nlogAll(\"a\", \"b\", \"c\", \"d\");\n\/\/ first: a\n\/\/ others: &#91;\"b\", \"c\", \"d\"&#93;\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">logAll<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">first<\/span><span style=\"color: #D4D4D4\">, ...<\/span><span style=\"color: #9CDCFE\">others<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">console<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;first:&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">first<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">console<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;others:&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">others<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">logAll<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;a&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;b&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;c&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;d&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ first: a<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ others: &#91;&quot;b&quot;, &quot;c&quot;, &quot;d&quot;&#93;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30b3\u30d4\u30fc\u30fb\u30de\u30fc\u30b8\uff08\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\uff09<\/h3>\n\n\n\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3082\u540c\u69d8\u306b\u6d45\u3044\u30b3\u30d4\u30fc\u3084\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u4e0a\u66f8\u304d\u30de\u30fc\u30b8\u306b\u4f7f\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">JavaScript<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>const obj1 = { x: 1, y: 2 };\nconst obj2 = { y: 99, z: 3 };\nconst merged = { ...obj1, ...obj2 }; \/\/ y\u304c\u4e0a\u66f8\u304d\u3055\u308c\u308b\n\nconsole.log(merged); \/\/ { x: 1, y: 99, z: 3 }\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">obj1<\/span><span style=\"color: #D4D4D4\"> = { <\/span><span style=\"color: #9CDCFE\">x:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">y:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">2<\/span><span style=\"color: #D4D4D4\"> };<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">obj2<\/span><span style=\"color: #D4D4D4\"> = { <\/span><span style=\"color: #9CDCFE\">y:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">99<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">z:<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">3<\/span><span style=\"color: #D4D4D4\"> };<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4FC1FF\">merged<\/span><span style=\"color: #D4D4D4\"> = { ...<\/span><span style=\"color: #9CDCFE\">obj1<\/span><span style=\"color: #D4D4D4\">, ...<\/span><span style=\"color: #9CDCFE\">obj2<\/span><span style=\"color: #D4D4D4\"> }; <\/span><span style=\"color: #6A9955\">\/\/ y\u304c\u4e0a\u66f8\u304d\u3055\u308c\u308b<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">console<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">merged<\/span><span style=\"color: #D4D4D4\">); <\/span><span style=\"color: #6A9955\">\/\/ { x: 1, y: 99, z: 3 }<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u3088\u304f\u3042\u308b\u30df\u30b9\u30fb\u8aa4\u89e3\u30fb\u843d\u3068\u3057\u7a74<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>...<\/code> \u306e\u524d\u5f8c\u95a2\u4fc2\u3092\u898b\u8aa4\u308b\u3068\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u3068\u6b8b\u4f59\u5f15\u6570\u3092\u6df7\u540c\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<strong>\u30b9\u30d7\u30ec\u30c3\u30c9\u306f\u5c55\u958b\u3001\u6b8b\u4f59\u5f15\u6570\u306f\u96c6\u7d04<\/strong>\u3068\u3044\u3046\u6a5f\u80fd\u306e\u9055\u3044\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/li>\n\n\n\n<li>\u914d\u5217\u30fb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u306f<strong>\u6d45\u3044\u30b3\u30d4\u30fc<\/strong>\u3067\u3042\u308b\u305f\u3081\u3001\u30cd\u30b9\u30c8\u3055\u308c\u305f\u69cb\u9020\u3067\u306f\u610f\u56f3\u3057\u306a\u3044\u5171\u6709\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u95a2\u6570\u5b9a\u7fa9\u306e\u5f15\u6570\u9806\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002\u6b8b\u4f59\u5f15\u6570\u306f<strong>\u6700\u5f8c\u306e\u5f15\u6570<\/strong>\u306b\u3057\u304b\u4f7f\u3048\u307e\u305b\u3093\u3002<\/li>\n\n\n\n<li>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u3067\u306f\u3001<strong>\u9806\u5e8f\u304c\u5f8c\u306e\u3082\u306e\u304c\u524d\u3092\u4e0a\u66f8\u304d<\/strong>\u3059\u308b\u305f\u3081\u3001\u30de\u30fc\u30b8\u306e\u512a\u5148\u9806\u4f4d\u3092\u610f\u8b58\u3057\u306a\u3044\u3068\u610f\u56f3\u3057\u306a\u3044\u5024\u306e\u4e0a\u66f8\u304d\u304c\u8d77\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\u3068\u6b8b\u4f59\u5f15\u6570\u306f\u3001\u3069\u3061\u3089\u3082 <code>...<\/code> \u3092\u4f7f\u3044\u307e\u3059\u304c\u3001\u610f\u5473\u3068\u7528\u9014\u306f\u307e\u3063\u305f\u304f\u7570\u306a\u308a\u307e\u3059\u3002\u914d\u5217\u3084\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5c55\u958b\u30fb\u8907\u88fd\u30fb\u7d50\u5408\u306b\u306f\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\u3092\u3001\u95a2\u6570\u3067\u306e\u53ef\u5909\u9577\u5f15\u6570\u306e\u53d7\u3051\u53d6\u308a\u306b\u306f\u6b8b\u4f59\u5f15\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u69cb\u6587\u306e\u67d4\u8edf\u3055\u3086\u3048\u306b\u8aa4\u7528\u3057\u3084\u3059\u3044\u305f\u3081\u3001\u300c\u5c55\u958b\u304b\u96c6\u7d04\u304b\u300d\u3092\u8ef8\u306b\u76ee\u7684\u306b\u5fdc\u3058\u3066\u6b63\u3057\u304f\u4f7f\u3044\u5206\u3051\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. \u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\u3068\u6b8b\u4f59\u5f15\u6570\u3068\u306f\uff1f JavaScript\u3067\u306f\u3001&#8230;\uff08\u30c9\u30c3\u30c83\u3064\uff09\u3092\u4f7f\u3063\u305f\u69cb\u6587\u304c2\u7a2e\u985e\u5b58\u5728\u3057\u307e\u3059\u30021\u3064\u306f\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\uff08spread syntax\uff09\u3001\u3082\u30461\u3064\u306f**\u6b8b\u4f59\u5f15\u6570\uff08re [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":942,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[86],"tags":[],"class_list":["post-864","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=864"}],"version-history":[{"count":2,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/864\/revisions"}],"predecessor-version":[{"id":943,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/864\/revisions\/943"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/942"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}