{"id":860,"date":"2025-08-05T16:46:07","date_gmt":"2025-08-05T07:46:07","guid":{"rendered":"https:\/\/nexive.tech\/?p=860"},"modified":"2025-08-05T16:46:07","modified_gmt":"2025-08-05T07:46:07","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%81%ae%e9%96%a2%e6%95%b0%e5%ae%9a%e7%be%a93%e3%83%91%e3%82%bf%e3%83%bc%e3%83%b3%ef%bc%88function%e5%ae%a3%e8%a8%80","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=860","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011JavaScript\u306e\u95a2\u6570\u5b9a\u7fa93\u30d1\u30bf\u30fc\u30f3\uff08function\u5ba3\u8a00\u30fb\u95a2\u6570\u5f0f\u30fb\u30a2\u30ed\u30fc\u95a2\u6570\uff09"},"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\u306b\u304a\u3051\u308b3\u7a2e\u985e\u306e\u95a2\u6570\u5b9a\u7fa9\u65b9\u6cd5\uff08function\u5ba3\u8a00\u3001\u95a2\u6570\u5f0f\u3001\u30a2\u30ed\u30fc\u95a2\u6570\uff09\u3092\u6b63\u78ba\u306b\u89e3\u8aac<\/li>\n\n\n\n<li>\u5404\u69cb\u6587\u306e\u4f7f\u3044\u5206\u3051\u3001\u30b9\u30b3\u30fc\u30d7\u3084this\u306e\u9055\u3044\u306a\u3069\u5b9f\u52d9\u3067\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u3092\u6574\u7406<\/li>\n\n\n\n<li>\u305d\u308c\u305e\u308c\u306e\u69cb\u6587\u306e\u5b9f\u884c\u53ef\u80fd\u306a\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3068\u51fa\u529b\u3092\u63d0\u793a<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. JavaScript\u306e\u95a2\u6570\u5b9a\u7fa9\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>JavaScript\u3067\u306f\u3001\u95a2\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u65b9\u6cd5\u304c\u8907\u6570\u3042\u308a\u307e\u3059\u3002<br>\u4e3b\u306a\u624b\u6bb5\u3068\u3057\u3066\u300cfunction\u5ba3\u8a00\u300d\u300c\u95a2\u6570\u5f0f\uff08function expression\uff09\u300d\u300c\u30a2\u30ed\u30fc\u95a2\u6570\uff08arrow function\uff09\u300d\u306e3\u3064\u304c\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u95a2\u6570\u306f\u3001\u51e6\u7406\u306e\u307e\u3068\u307e\u308a\u3092\u5b9a\u7fa9\u3057\u518d\u5229\u7528\u53ef\u80fd\u306b\u3059\u308b\u57fa\u672c\u69cb\u6587\u3067\u3042\u308a\u3001JavaScript\u306e\u3042\u3089\u3086\u308b\u5834\u9762\uff08DOM\u64cd\u4f5c\u3001\u975e\u540c\u671f\u51e6\u7406\u3001\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3001API\u5b9f\u88c5\u306a\u3069\uff09\u3067\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u308c\u305e\u308c\u306e\u95a2\u6570\u5b9a\u7fa9\u65b9\u6cd5\u306b\u306f\u3001\u69cb\u6587\u4e0a\u306e\u9055\u3044\u3060\u3051\u3067\u306a\u304f\u3001\u30b9\u30b3\u30fc\u30d7\u3084\u5dfb\u304d\u4e0a\u3052\uff08hoisting\uff09\u3001this\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3001\u9069\u7528\u53ef\u80fd\u306a\u5834\u9762\u306b\u9055\u3044\u304c\u3042\u308a\u307e\u3059\u3002<br>\u305d\u306e\u305f\u3081\u3001\u69cb\u6587\u306e\u9055\u3044\u3092\u5358\u306b\u899a\u3048\u308b\u3060\u3051\u3067\u306a\u304f\u3001\u300c\u3069\u306e\u3088\u3046\u306a\u5834\u9762\u3067\u3069\u306e\u66f8\u304d\u65b9\u3092\u9078\u3076\u3079\u304d\u304b\u300d\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u304c\u3001\u5b9f\u52d9\u3067\u306f\u7279\u306b\u91cd\u8981\u306b\u306a\u308a\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\">function\u5ba3\u8a00\uff08Function Declaration\uff09<\/h3>\n\n\n\n<p>\u30c8\u30c3\u30d7\u30ec\u30d9\u30eb\u3084\u30b9\u30b3\u30fc\u30d7\u5185\u3067\u95a2\u6570\u3092\u5ba3\u8a00\u3059\u308b\u969b\u306b\u3088\u304f\u4f7f\u308f\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\u5ba3\u8a00\nfunction greet(name) {\n  return `Hello, ${name}`;\n}\n\nconsole.log(greet(\"Alice\"));\n\/\/ \u51fa\u529b: Hello, Alice\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: #6A9955\">\/\/ function\u5ba3\u8a00<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">greet<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">name<\/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: #CE9178\">`Hello, <\/span><span style=\"color: #569CD6\">${<\/span><span style=\"color: #9CDCFE\">name<\/span><span style=\"color: #569CD6\">}<\/span><span style=\"color: #CE9178\">`<\/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: #9CDCFE\">console<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #DCDCAA\">greet<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;Alice&quot;<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: Hello, Alice<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u5f62\u5f0f\u306f<strong>\u5dfb\u304d\u4e0a\u3052\uff08hoisting\uff09\u3055\u308c\u308b<\/strong>\u305f\u3081\u3001\u5ba3\u8a00\u3088\u308a\u524d\u3067\u547c\u3073\u51fa\u3059\u3053\u3068\u3082\u53ef\u80fd\u3067\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>console.log(add(2, 3));\n\nfunction add(a, b) {\n  return a + b;\n}\n\/\/ \u51fa\u529b: 5\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: #9CDCFE\">console<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #DCDCAA\">add<\/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\">));<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">add<\/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>\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>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: 5<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u95a2\u6570\u5f0f\uff08Function Expression\uff09<\/h3>\n\n\n\n<p>\u5909\u6570\u306b\u7121\u540d\u95a2\u6570\u3092\u4ee3\u5165\u3059\u308b\u5f62\u5f0f\u3067\u3059\u3002\u4e3b\u306b\u95a2\u6570\u3092\u5024\u3068\u3057\u3066\u6271\u3046\u5834\u9762\uff08\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306a\u3069\uff09\u3067\u4f7f\u7528\u3055\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>\/\/ \u95a2\u6570\u5f0f\nconst multiply = function(a, b) {\n  return a * b;\n};\n\nconsole.log(multiply(3, 4));\n\/\/ \u51fa\u529b: 12\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: #6A9955\">\/\/ \u95a2\u6570\u5f0f<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">multiply<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">function<\/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>\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>\n<span class=\"line\"><span style=\"color: #D4D4D4\">};<\/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: #DCDCAA\">multiply<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #B5CEA8\">3<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">4<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: 12<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u95a2\u6570\u5f0f\u306f<strong>\u5dfb\u304d\u4e0a\u3052\u3055\u308c\u307e\u305b\u3093<\/strong>\u3002\u5b9a\u7fa9\u524d\u306b\u547c\u3073\u51fa\u3059\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\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>console.log(divide(10, 2)); \/\/ ReferenceError\n\nconst divide = function(a, b) {\n  return a \/ b;\n};\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: #9CDCFE\">console<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #DCDCAA\">divide<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #B5CEA8\">10<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">2<\/span><span style=\"color: #D4D4D4\">)); <\/span><span style=\"color: #6A9955\">\/\/ ReferenceError<\/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: #DCDCAA\">divide<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">function<\/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>\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>\n<span class=\"line\"><span style=\"color: #D4D4D4\">};<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u30a2\u30ed\u30fc\u95a2\u6570\uff08Arrow Function\uff09<\/h3>\n\n\n\n<p>\u77ed\u304f\u66f8\u3051\u308b\u69cb\u6587\u3067\u3001\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3084\u9ad8\u968e\u95a2\u6570\u3067\u3088\u304f\u4f7f\u308f\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>\/\/ \u30a2\u30ed\u30fc\u95a2\u6570\uff08\u7701\u7565\u306a\u3057\uff09\nconst square = (n) => {\n  return n * n;\n};\nconsole.log(square(5));\n\/\/ \u51fa\u529b: 25\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: #6A9955\">\/\/ \u30a2\u30ed\u30fc\u95a2\u6570\uff08\u7701\u7565\u306a\u3057\uff09<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">square<\/span><span style=\"color: #D4D4D4\"> = (<\/span><span style=\"color: #9CDCFE\">n<\/span><span style=\"color: #D4D4D4\">) <\/span><span style=\"color: #569CD6\">=&gt;<\/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\">n<\/span><span style=\"color: #D4D4D4\"> * <\/span><span style=\"color: #9CDCFE\">n<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">};<\/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\">square<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #B5CEA8\">5<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: 25<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\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>\/\/ \u30a2\u30ed\u30fc\u95a2\u6570\uff08\u7701\u7565\u5f62\uff09\nconst square2 = n => n * n;\nconsole.log(square2(6));\n\/\/ \u51fa\u529b: 36\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: #6A9955\">\/\/ \u30a2\u30ed\u30fc\u95a2\u6570\uff08\u7701\u7565\u5f62\uff09<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">const<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">square2<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">n<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">n<\/span><span style=\"color: #D4D4D4\"> * <\/span><span style=\"color: #9CDCFE\">n<\/span><span style=\"color: #D4D4D4\">;<\/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\">square2<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #B5CEA8\">6<\/span><span style=\"color: #D4D4D4\">));<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: 36<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u30a2\u30ed\u30fc\u95a2\u6570\u306f<strong>this\u3092\u675f\u7e1b\u3057\u307e\u305b\u3093<\/strong>\u3002\u305d\u306e\u305f\u3081\u3001\u30af\u30e9\u30b9\u30e1\u30bd\u30c3\u30c9\u3084setTimeout\u5185\u3067\u306e\u5229\u7528\u6642\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\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 Timer() {\n  this.seconds = 0;\n  setInterval(() => {\n    this.seconds++;\n  }, 1000);\n}\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\">Timer<\/span><span style=\"color: #D4D4D4\">() {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">seconds<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">setInterval<\/span><span style=\"color: #D4D4D4\">(() <\/span><span style=\"color: #569CD6\">=&gt;<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">this<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">seconds<\/span><span style=\"color: #D4D4D4\">++;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  }, <\/span><span style=\"color: #B5CEA8\">1000<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u5f93\u6765\u306efunction\u5f0f\u3067\u66f8\u3044\u305f\u5834\u5408\u3001this\u304c\u7570\u306a\u308a\u671f\u5f85\u901a\u308a\u306b\u52d5\u4f5c\u3057\u307e\u305b\u3093\u3002<\/p>\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<p>function\u5ba3\u8a00\u3068\u95a2\u6570\u5f0f\u3092\u6df7\u540c\u3057\u3001\u5dfb\u304d\u4e0a\u3052\u306e\u6319\u52d5\u306b\u95a2\u3059\u308b\u8aa4\u89e3\u304c\u3088\u304f\u898b\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u95a2\u6570\u5f0f\u3084\u30a2\u30ed\u30fc\u95a2\u6570\u306f\u300c\u5b9a\u7fa9\u3088\u308a\u524d\u3067\u306f\u4f7f\u3048\u306a\u3044\u300d\u3053\u3068\u3092\u524d\u63d0\u306b\u8a2d\u8a08\u3059\u3079\u304d\u3067\u3059\u3002<br>\u307e\u305f\u3001\u30a2\u30ed\u30fc\u95a2\u6570\u306fthis\u306e\u6319\u52d5\u304c\u7279\u6b8a\u3067\u3042\u308b\u305f\u3081\u3001\u30af\u30e9\u30b9\u5b9a\u7fa9\u3084DOM\u30a4\u30d9\u30f3\u30c8\u3067\u306e\u6271\u3044\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3055\u3089\u306b\u3001\u53ef\u8aad\u6027\u91cd\u8996\u306e\u89b3\u70b9\u3067\u306f\u3001\u9577\u3044\u51e6\u7406\u3084\u8907\u96d1\u306a\u30ed\u30b8\u30c3\u30af\u306b\u306f\u30a2\u30ed\u30fc\u95a2\u6570\u3088\u308afunction\u5ba3\u8a00\u306e\u65b9\u304c\u9069\u3057\u3066\u3044\u307e\u3059\u3002<br>\u4e00\u65b9\u3067\u3001\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u30841\u884c\u51e6\u7406\u306b\u306f\u30a2\u30ed\u30fc\u95a2\u6570\u306e\u307b\u3046\u304c\u5197\u9577\u6027\u304c\u6291\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<p>JavaScript\u3067\u306f\u3001function\u5ba3\u8a00\u3001\u95a2\u6570\u5f0f\u3001\u30a2\u30ed\u30fc\u95a2\u6570\u306e3\u7a2e\u985e\u306e\u69cb\u6587\u304c\u3042\u308a\u3001\u305d\u308c\u305e\u308c\u5dfb\u304d\u4e0a\u3052\u3084this\u306e\u6271\u3044\u306b\u9055\u3044\u304c\u3042\u308a\u307e\u3059\u3002<br>\u5b9f\u52d9\u3067\u306f\u3001\u6319\u52d5\u306e\u9055\u3044\u3068\u8a2d\u8a08\u610f\u56f3\u3092\u8e0f\u307e\u3048\u3066\u69cb\u6587\u3092\u9078\u3076\u3053\u3068\u304c\u6c42\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3084\u5373\u5e2d\u306e1\u884c\u95a2\u6570\u306b\u306f\u30a2\u30ed\u30fc\u95a2\u6570\u3001\u8907\u96d1\u306a\u51e6\u7406\u3084\u518d\u5229\u7528\u6027\u306e\u3042\u308b\u95a2\u6570\u306b\u306ffunction\u5ba3\u8a00\u3092\u4f7f\u3046\u306e\u304c\u4e00\u822c\u7684\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. JavaScript\u306e\u95a2\u6570\u5b9a\u7fa9\u3068\u306f\uff1f JavaScript\u3067\u306f\u3001\u95a2\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u65b9\u6cd5\u304c\u8907\u6570\u3042\u308a\u307e\u3059\u3002\u4e3b\u306a\u624b\u6bb5\u3068\u3057\u3066\u300cfunction\u5ba3\u8a00\u300d\u300c\u95a2\u6570\u5f0f\uff08function expression\uff09\u300d\u300c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":938,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[86],"tags":[],"class_list":["post-860","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\/860","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=860"}],"version-history":[{"count":2,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/860\/revisions"}],"predecessor-version":[{"id":939,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/860\/revisions\/939"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/938"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}