{"id":18457,"date":"2026-07-19T06:51:11","date_gmt":"2026-07-18T21:51:11","guid":{"rendered":"https:\/\/genai-ai.co.jp\/ai-kanri\/?p=18457"},"modified":"2026-07-19T06:51:11","modified_gmt":"2026-07-18T21:51:11","slug":"cc-js-length","status":"publish","type":"post","link":"https:\/\/genai-ai.co.jp\/ai-kanri\/blog\/cc-js-length\/","title":{"rendered":"\u30102026\u5e747\u6708\u6700\u65b0\u3011JavaScript length\u3067\u6587\u5b57\u5217\u30fb\u914d\u5217\u306e\u9577\u3055\u3092\u53d6\u5f97\u3059\u308b\u5b8c\u5168\u30ac\u30a4\u30c9\uff5c\u7d75\u6587\u5b57\u30fbUnicode\u5bfe\u5fdc\u3068Claude Code\u6d3b\u7528"},"content":{"rendered":"\n<style>\n.g-flow-row{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;align-items:center;}\n.g-flow-item{background:linear-gradient(135deg,#1a1a1a,#2a1015);color:#fff;border-radius:8px;padding:16px 14px;min-width:130px;flex:1;text-align:center;}\n.g-flow-arrow{color:#dc2626;font-size:20px;font-weight:700;}\n.g-card-row{display:flex;gap:12px;flex-wrap:wrap;margin:0 0 32px;}\n.g-card-row>div{flex:1;min-width:220px;}\n@media(max-width:600px){\n  .g-flow-row{flex-direction:column;}\n  .g-flow-arrow{transform:rotate(90deg);}\n  .g-card-row{flex-direction:column;}\n  .g-card-row>div{min-width:100%;}\n}\n<\/style>\n\n\n\n<div style=\"margin:0 0 32px;\">\n  <img decoding=\"async\" src=\"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-content\/uploads\/2026\/07\/thumb-cc-js-length.jpg\" alt=\"\u30102026\u5e747\u6708\u6700\u65b0\u3011JavaScript length\u3067\u6587\u5b57\u5217\u30fb\u914d\u5217\u306e\u9577\u3055\u3092\u53d6\u5f97\u3059\u308b\u5b8c\u5168\u30ac\u30a4\u30c9\uff5c\u7d75\u6587\u5b57\u30fbUnicode\u5bfe\u5fdc\u3068Claude Code\u6d3b\u7528\" style=\"width:100%;height:auto;border-radius:12px;display:block;\">\n<\/div>\n\n\n\n<div style=\"background:#f8f9fa;border-radius:12px;padding:24px 28px;margin:0 0 32px;border-left:4px solid #0ea5e9;\">\n  <p style=\"font-size:15px;font-weight:700;color:#1a1a1a;margin:0 0 16px;\">\u3053\u306e\u8a18\u4e8b\u306e\u5185\u5bb9<\/p>\n  <ol style=\"margin:0;padding-left:20px;font-size:14px;line-height:2.2;list-style:none;\">\n    <li><a href=\"#sec-01\" style=\"color:#495057;text-decoration:none;\"><span style=\"color:#0ea5e9;font-weight:700;margin-right:8px;\">01<\/span>length\u3068\u306f\u4f55\u304b\uff5c\u6587\u5b57\u5217\u30fb\u914d\u5217\u30fb\u95a2\u6570\u306elength\u306e\u9055\u3044<\/a><\/li>\n    <li><a href=\"#sec-02\" style=\"color:#495057;text-decoration:none;\"><span style=\"color:#0ea5e9;font-weight:700;margin-right:8px;\">02<\/span>\u6587\u5b57\u5217\u306elength\uff1a\u6587\u5b57\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u57fa\u672c<\/a><\/li>\n    <li><a href=\"#sec-03\" style=\"color:#495057;text-decoration:none;\"><span style=\"color:#0ea5e9;font-weight:700;margin-right:8px;\">03<\/span>\u7d75\u6587\u5b57\u30fb\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u3067length\u304c\u30ba\u30ec\u308b\u843d\u3068\u3057\u7a74<\/a><\/li>\n    <li><a href=\"#sec-04\" style=\"color:#495057;text-decoration:none;\"><span style=\"color:#0ea5e9;font-weight:700;margin-right:8px;\">04<\/span>Array.from()\u3068\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\u3067\u6b63\u78ba\u306a\u6587\u5b57\u6570\u3092\u53d6\u5f97<\/a><\/li>\n    <li><a href=\"#sec-05\" style=\"color:#495057;text-decoration:none;\"><span style=\"color:#0ea5e9;font-weight:700;margin-right:8px;\">05<\/span>\u914d\u5217\u306elength\uff1a\u8981\u7d20\u6570\u306e\u53d6\u5f97\u3068\u914d\u5217\u306e\u672b\u5c3e\u51e6\u7406<\/a><\/li>\n    <li><a href=\"#sec-06\" style=\"color:#495057;text-decoration:none;\"><span style=\"color:#0ea5e9;font-weight:700;margin-right:8px;\">06<\/span>\u95a2\u6570\u306elength\uff1a\u5f15\u6570\u306e\u6570\u3092\u78ba\u8a8d\u3059\u308b<\/a><\/li>\n    <li><a href=\"#sec-07\" style=\"color:#495057;text-decoration:none;\"><span style=\"color:#0ea5e9;font-weight:700;margin-right:8px;\">07<\/span>length\u3092\u4f7f\u3063\u305f\u5b9f\u52d9\u30d1\u30bf\u30fc\u30f3<\/a><\/li>\n    <li><a href=\"#sec-08\" style=\"color:#495057;text-decoration:none;\"><span style=\"color:#0ea5e9;font-weight:700;margin-right:8px;\">08<\/span>Claude Code\u3067length\u306eJavaScript\u30b3\u30fc\u30c9\u3092\u81ea\u52d5\u751f\u6210\u3059\u308b<\/a><\/li>\n    <li><a href=\"#faq\" style=\"color:#495057;text-decoration:none;\"><span style=\"color:#0ea5e9;font-weight:700;margin-right:8px;\">FAQ<\/span>\u3088\u304f\u3042\u308b\u8cea\u554f<\/a><\/li>\n  <\/ol>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">JavaScript\u3067\u6700\u3082\u983b\u7e41\u306b\u4f7f\u3046\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u4e00\u3064\u304c<strong>length<\/strong>\u3067\u3059\u3002\u6587\u5b57\u5217\u306e\u6587\u5b57\u6570\u3001\u914d\u5217\u306e\u8981\u7d20\u6570\u3001\u95a2\u6570\u306e\u5f15\u6570\u306e\u6570\u306a\u3069\u3001\u3055\u307e\u3056\u307e\u306a\u30c7\u30fc\u30bf\u306e\u300c\u9577\u3055\u300d\u3092\u8fd4\u3057\u307e\u3059\u3002\u30b7\u30f3\u30d7\u30eb\u306b\u898b\u3048\u3066\u3082\u3046\u4e00\u6b69\u8e0f\u307f\u8fbc\u3080\u3068\u3001<strong>\u7d75\u6587\u5b57\u3092\u542b\u3080\u6587\u5b57\u5217\u3067length\u304c\u671f\u5f85\u5024\u3068\u30ba\u30ec\u308b<\/strong>\u3068\u3044\u3046JavaScript\u7279\u6709\u306e\u843d\u3068\u3057\u7a74\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001length\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u57fa\u672c\u304b\u3089\u3001\u6587\u5b57\u5217\u30fb\u914d\u5217\u30fb\u95a2\u6570\u305d\u308c\u305e\u308c\u306e\u4f7f\u3044\u65b9\u3001\u7d75\u6587\u5b57\u30fb\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306eUnicode\u554f\u984c\u3068\u305d\u306e\u89e3\u6c7a\u7b56\u3001\u5b9f\u52d9\u3067\u3088\u304f\u4f7f\u3046\u30d1\u30bf\u30fc\u30f3\u3001Claude Code\u3067\u306e\u30b3\u30fc\u30c9\u81ea\u52d5\u751f\u6210\u307e\u3067\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"balloon-wrap is-right\">\n  <div class=\"balloon-icon\">\n    <img decoding=\"async\" src=\"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-content\/uploads\/2026\/04\/yamazaki-avatar.png\" alt=\"AI\u9b3c\u7ba1\u7406\u5c71\u5d0e\">\n    <span class=\"balloon-name\">AI\u9b3c\u7ba1\u7406\u5c71\u5d0e<\/span>\n  <\/div>\n  <div class=\"balloon-body\">JavaScript\u306e\u6587\u5b57\u5217\u306f\u5185\u90e8\u7684\u306bUTF-16\u3067\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u7d75\u6587\u5b57\uff08\u4f8b: &#128516;\uff09\u306e\u3088\u3046\u306aU+FFFF\u3092\u8d85\u3048\u308bUnicode\u6587\u5b57\u306f2\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\uff08\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\uff09\u3068\u3057\u3066\u6271\u308f\u308c\u307e\u3059\u3002\u305d\u306e\u305f\u3081\"&#128516;\".length\u306f1\u3067\u306f\u306a\u304f2\u3092\u8fd4\u3057\u307e\u3059\u3002\u3053\u308c\u304clength\u306e\u30ba\u30ec\u306e\u539f\u56e0\u3067\u3059\u3002<\/div>\n<\/div>\n\n\n\n<div style=\"background:#fafafa;border-radius:8px;padding:16px 20px;margin:16px 0;border-left:4px solid #dc2626;\">\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>\u6587\u5b57\u5217\u306elength<\/strong>\uff1a\u6587\u5b57\u6570\uff08\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u6570\uff09\u3092\u8fd4\u3059\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>\u7d75\u6587\u5b57\u30fb\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2<\/strong>\u3067length\u304c\u671f\u5f85\u5024\u3068\u30ba\u30ec\u308b\u539f\u56e0\u3068\u4ed5\u7d44\u307f<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>Array.from(str).length<\/strong>\u3067Unicode\u5bfe\u5fdc\u306e\u6b63\u78ba\u306a\u6587\u5b57\u6570\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>\u914d\u5217\u306elength<\/strong>\uff1a\u8981\u7d20\u6570\u306e\u53d6\u5f97\u30fb\u914d\u5217\u306e\u672b\u5c3e\u8ffd\u52a0\u30fb\u914d\u5217\u306e\u521d\u671f\u5316<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>\u95a2\u6570\u306elength<\/strong>\uff1a\u5b9a\u7fa9\u3055\u308c\u305f\u5f15\u6570\u306e\u6570\u3092\u78ba\u8a8d\u3059\u308b\u4f7f\u3044\u65b9<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span>length=0\u30c1\u30a7\u30c3\u30af\u30fb\u6700\u5927\u6587\u5b57\u6570\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30fb\u30eb\u30fc\u30d7\u306e\u7d42\u4e86\u6761\u4ef6\u306a\u3069\u306e<strong>\u5b9f\u52d9\u30d1\u30bf\u30fc\u30f3<\/strong><\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>Claude Code<\/strong>\u3067JavaScript\u306elength\u51e6\u7406\u30b3\u30fc\u30c9\u3092\u81ea\u52d5\u751f\u6210\u3059\u308b\u65b9\u6cd5<\/span><\/div>\n\n<\/div>\n\n\n\n<div id=\"sec-01\"><\/div>\n<h2 class=\"section-header-img\" style=\"margin:32px 0 24px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);padding:32px 28px;color:#fff;position:relative;border:none;border-left:none;text-align:left;\">\n  <span class=\"section-number\" style=\"display:block;\">01<\/span>\n  <span class=\"section-label\" style=\"display:block;\">WHAT<\/span>\n  <span class=\"section-title\" style=\"display:block;\">length\u3068\u306f\u4f55\u304b\uff5c\u6587\u5b57\u5217\u30fb\u914d\u5217\u30fb\u95a2\u6570\u306elength\u306e\u9055\u3044<\/span>\n  <span class=\"section-desc\">3\u7a2e\u985e\u306elength\u306e\u8fd4\u308a\u5024\u3068\u7528\u9014\u3092\u6574\u7406\u3059\u308b<\/span>\n<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>length<\/code>\u306fJavaScript\u3067\u30c7\u30fc\u30bf\u306e\u300c\u30b5\u30a4\u30ba\u300d\u300c\u9577\u3055\u300d\u3092\u8fd4\u3059\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u3059\u3002\u6587\u5b57\u5217\u30fb\u914d\u5217\u30fb\u95a2\u6570\u306e3\u7a2e\u985e\u3067\u610f\u5473\u304c\u7570\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div style=\"background:#f8f9fa;border-left:4px solid #6b7280;border-radius:0 8px 8px 0;padding:16px 20px;margin:20px 0;\">\n  <p style=\"margin:0 0 4px;font-size:13px;font-weight:700;color:#6b7280;letter-spacing:1px;\">&#128218; \u7528\u8a9e\u89e3\u8aac<\/p>\n  <p style=\"margin:0;font-size:15px;line-height:1.7;\"><strong>length\u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\uff1aJavaScript\u306e\u7d44\u307f\u8fbc\u307f\u30d7\u30ed\u30d1\u30c6\u30a3\u3002\u6587\u5b57\u5217\u3067\u306fUTF-16\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u6570\uff08\u2252\u6587\u5b57\u6570\u3060\u304c\u7d75\u6587\u5b57\u3067\u5dee\u7570\u3042\u308a\uff09\u3001\u914d\u5217\u3067\u306f\u8981\u7d20\u6570\uff08\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u6700\u5927\u5024+1\uff09\u3001\u95a2\u6570\u3067\u306f\u5b9a\u7fa9\u3055\u308c\u305f\u5f15\u6570\uff08\u30d1\u30e9\u30e1\u30fc\u30bf\uff09\u306e\u6570\u3092\u8fd4\u3059\u3002\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u306a\u304f\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u305f\u3081\u62ec\u5f27\u306f\u4e0d\u8981\uff08str.length()\u306f\u30a8\u30e9\u30fc\u3001str.length\u304c\u6b63\u3057\u3044\uff09\u3002\u8aad\u307f\u53d6\u308a\u5c02\u7528\uff08\u6587\u5b57\u5217\u306e\u5834\u5408\uff09\u307e\u305f\u306f\u66f8\u304d\u8fbc\u307f\u53ef\u80fd\uff08\u914d\u5217\u306e\u5834\u5408\u306flength=0\u3067\u5168\u8981\u7d20\u524a\u9664\uff09\u3002<\/p>\n<\/div>\n\n\n\n<table>\n<thead><tr><th>\u5bfe\u8c61<\/th><th>\u8fd4\u308a\u5024<\/th><th>\u4f8b<\/th><\/tr><\/thead>\n<tbody>\n<tr><td>\u6587\u5b57\u5217<\/td><td>UTF-16\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u6570<\/td><td>\"hello\".length \u2192 5<\/td><\/tr>\n<tr><td>\u914d\u5217<\/td><td>\u8981\u7d20\u6570\uff08\u6700\u5927\u30a4\u30f3\u30c7\u30c3\u30af\u30b9+1\uff09<\/td><td>[1, 2, 3].length \u2192 3<\/td><\/tr>\n<tr><td>\u95a2\u6570<\/td><td>\u5b9a\u7fa9\u3055\u308c\u305f\u5f15\u6570\u306e\u6570<\/td><td>function f(a,b){}.length \u2192 2<\/td><\/tr>\n<\/tbody>\n<\/table>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ \u6587\u5b57\u5217\u306elength\nconst str = \"\u3053\u3093\u306b\u3061\u306f\";\nconsole.log(str.length);  \/\/ \u2192 5\n\n\/\/ \u914d\u5217\u306elength\nconst arr = [10, 20, 30, 40];\nconsole.log(arr.length);  \/\/ \u2192 4\n\n\/\/ \u95a2\u6570\u306elength\nfunction greet(name, greeting) {\n  return greeting + ', ' + name;\n}\nconsole.log(greet.length);  \/\/ \u2192 2\uff08\u5f15\u6570\u304c2\u3064\uff09\n\n\/\/ length\u306f\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u306a\u304f\u30d7\u30ed\u30d1\u30c6\u30a3\uff08\u62ec\u5f27\u4e0d\u8981\uff09\nconsole.log(\"test\".length);   \/\/ \u2192 4\n\/\/ console.log(\"test\".length()); \u2192 \u30a8\u30e9\u30fc\uff01 not a function<\/pre>\n<\/div>\n\n\n\n<div id=\"sec-02\"><\/div>\n<h2 class=\"section-header-img\" style=\"margin:32px 0 24px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);padding:32px 28px;color:#fff;position:relative;border:none;border-left:none;text-align:left;\">\n  <span class=\"section-number\" style=\"display:block;\">02<\/span>\n  <span class=\"section-label\" style=\"display:block;\">STRING<\/span>\n  <span class=\"section-title\" style=\"display:block;\">\u6587\u5b57\u5217\u306elength\uff1a\u6587\u5b57\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u57fa\u672c<\/span>\n  <span class=\"section-desc\">\u6587\u5b57\u5217\u306e\u9577\u3055\u3092\u53d6\u5f97\u3059\u308b\u57fa\u672c\u64cd\u4f5c\u3068\u3088\u304f\u3042\u308b\u4f7f\u3044\u65b9<\/span>\n<\/h2>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ \u6587\u5b57\u5217\u306elength\u306e\u57fa\u672c\nconst text = \"Hello, World!\";\nconsole.log(text.length);  \/\/ \u2192 13\n\n\/\/ \u7a7a\u6587\u5b57\u5217\nconsole.log(\"\".length);  \/\/ \u2192 0\n\n\/\/ \u30b9\u30da\u30fc\u30b9\u30821\u6587\u5b57\nconsole.log(\"a b\".length);  \/\/ \u2192 3\n\n\/\/ \u65e5\u672c\u8a9e\uff08\u3072\u3089\u304c\u306a\u30fb\u30ab\u30bf\u30ab\u30ca\u30fb\u6f22\u5b57\uff09\u306f\u54041\nconsole.log(\"\u3042\u3044\u3046\".length);     \/\/ \u2192 3\nconsole.log(\"\u6771\u4eac\u90fd\".length);     \/\/ \u2192 3\nconsole.log(\"\u30a2\u30a4\u30a6\u30a8\u30aa\".length); \/\/ \u2192 5\n\n\/\/ \u6570\u5b57\uff08\u6587\u5b57\u5217\u3068\u3057\u3066\uff09\nconsole.log(\"12345\".length);  \/\/ \u2192 5\n\n\/\/ \u6539\u884c\u30b3\u30fc\u30c9\nconsole.log(\"line1\\nline2\".length);  \/\/ \u2192 11\uff08\\n\u306f1\u6587\u5b57\uff09<\/pre>\n<\/div>\n\n\n\n<div style=\"background:#f0fdf4;border:1px solid #22c55e;border-radius:8px;padding:20px 24px;margin:24px 0;\">\n  <div style=\"display:flex;align-items:center;gap:8px;margin-bottom:12px;\">\n    <span style=\"font-size:18px;\">&#128161;<\/span>\n    <strong style=\"color:#16a34a;font-size:15px;\">length\u306f\u30d7\u30ed\u30d1\u30c6\u30a3\u547c\u3073\u51fa\u3057\u304c\u30bc\u30ed\u30b3\u30b9\u30c8<\/strong>\n  <\/div>\n  <p style=\"margin:0;font-size:15px;line-height:1.8;color:#333;\">JavaScript\u30a8\u30f3\u30b8\u30f3\u306f\u6587\u5b57\u5217\u3092\u4f5c\u6210\u3057\u305f\u6642\u70b9\u3067length\u306e\u5024\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\u305f\u3081\u3001str.length\u3092\u4f55\u5ea6\u547c\u3073\u51fa\u3057\u3066\u3082O(1)\uff08\u4e00\u5b9a\u6642\u9593\uff09\u3067\u8fd4\u308a\u307e\u3059\u3002\u30eb\u30fc\u30d7\u5185\u3067str.length\u3092\u6bce\u56de\u547c\u3073\u51fa\u3057\u3066\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\uff08\u305f\u3060\u3057\u914d\u5217\u306e\u8981\u7d20\u3092\u52d5\u7684\u306b\u8ffd\u52a0\u30fb\u524a\u9664\u3059\u308b\u5834\u5408\u306f\u3001\u30eb\u30fc\u30d7\u306e\u90fd\u5ea6\u518d\u8a55\u4fa1\u3055\u308c\u307e\u3059\uff09\u3002<\/p>\n<\/div>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ length\u3092\u4f7f\u3063\u305f\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u4f8b\n\n\/\/ 1. \u7a7a\u6587\u5b57\u30c1\u30a7\u30c3\u30af\nconst input = \"\";\nif (input.length === 0) {\n  console.log(\"\u5165\u529b\u304c\u7a7a\u3067\u3059\");\n}\n\n\/\/ 2. \u6700\u5927\u6587\u5b57\u6570\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\nconst tweet = \"\u3053\u308c\u306f\u30c4\u30a4\u30fc\u30c8\u306e\u30b5\u30f3\u30d7\u30eb\u30c6\u30ad\u30b9\u30c8\u3067\u3059\u3002140\u5b57\u4ee5\u5185\u306b\u53ce\u3081\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\";\nconst MAX_LENGTH = 140;\n\nif (tweet.length > MAX_LENGTH) {\n  console.log(`\u6587\u5b57\u6570\u30aa\u30fc\u30d0\u30fc: ${tweet.length}\/${MAX_LENGTH}\u6587\u5b57`);\n} else {\n  console.log(`OK: ${tweet.length}\/${MAX_LENGTH}\u6587\u5b57`);\n}\n\n\/\/ 3. \u6587\u5b57\u5217\u306e\u672b\u5c3eN\u6587\u5b57\u3092\u53d6\u5f97\nconst str = \"HelloWorld\";\nconst last3 = str.slice(str.length - 3);  \/\/ \u2192 \"rld\"\n\/\/ \u307e\u305f\u306f str.slice(-3)  \/\/ \u8ca0\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u3082\u540c\u3058\n\n\/\/ 4. \u6587\u5b57\u5217\u3092\u9006\u9806\u306b\u3059\u308b\uff08\u7c21\u6613\u7248\uff09\nconst reversed = str.split(\"\").reverse().join(\"\");\nconsole.log(reversed);  \/\/ \u2192 \"dlroWolleH\"\nconsole.log(str.length === reversed.length);  \/\/ \u2192 true<\/pre>\n<\/div>\n\n\n\n<div id=\"sec-03\"><\/div>\n<h2 class=\"section-header-img\" style=\"margin:32px 0 24px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);padding:32px 28px;color:#fff;position:relative;border:none;border-left:none;text-align:left;\">\n  <span class=\"section-number\" style=\"display:block;\">03<\/span>\n  <span class=\"section-label\" style=\"display:block;\">UNICODE<\/span>\n  <span class=\"section-title\" style=\"display:block;\">\u7d75\u6587\u5b57\u30fb\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u3067length\u304c\u30ba\u30ec\u308b\u843d\u3068\u3057\u7a74<\/span>\n  <span class=\"section-desc\">JavaScript\u306e\u6587\u5b57\u5217\u306fUTF-16\u3002BMP\u5916\u306e\u6587\u5b57\u306f2\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8<\/span>\n<\/h2>\n\n\n\n<div style=\"background:#fef2f2;border:2px solid #dc2626;border-radius:8px;padding:20px 24px;margin:24px 0;\">\n  <div style=\"display:flex;align-items:center;gap:8px;margin-bottom:12px;\">\n    <span style=\"font-size:20px;\">&#9888;&#65039;<\/span>\n    <strong style=\"color:#dc2626;font-size:16px;\">\u7d75\u6587\u5b57\u3092\u542b\u3080\u6587\u5b57\u5217\u3067length\u304c\u300c2\u500d\u300d\u306b\u306a\u308b\uff01<\/strong>\n  <\/div>\n  <p style=\"margin:0;font-size:15px;line-height:1.8;color:#333;\">JavaScript\u306e\u6587\u5b57\u5217\u306f\u5185\u90e8\u7684\u306bUTF-16\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u7ba1\u7406\u3055\u308c\u3066\u3044\u307e\u3059\u3002Unicode Basic Multilingual Plane\uff08BMP\u3001U+0000\u301cU+FFFF\uff09\u5185\u306e\u6587\u5b57\u306f1\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\uff08length=1\uff09\u3067\u3059\u304c\u3001\u305d\u308c\u4ee5\u5916\u306e\u6587\u5b57\uff08\u591a\u304f\u306e\u7d75\u6587\u5b57\u30fb\u4e00\u90e8\u306e\u6f22\u5b57\u7b49\uff09\u306f\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u3068\u547c\u3070\u308c\u308b2\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u3067\u8868\u73fe\u3055\u308c\u308b\u305f\u3081\u3001length=2\u306b\u306a\u308a\u307e\u3059\u3002\"\ud83d\ude00\".length\u306f2\u3092\u8fd4\u3057\u307e\u3059\u304c\u3001\u4eba\u9593\u304c\u8a8d\u8b58\u3059\u308b\u300c\u6587\u5b57\u6570\u300d\u306f1\u3067\u3059\u3002<\/p>\n<\/div>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ \u7d75\u6587\u5b57\u3067length\u304c\u30ba\u30ec\u308b\u4f8b\nconsole.log(\"A\".length);      \/\/ \u2192 1\uff08ASCII\u3001BMP\u5185\uff09\nconsole.log(\"\u3042\".length);     \/\/ \u2192 1\uff08\u3072\u3089\u304c\u306a\u3001BMP\u5185\uff09\nconsole.log(\"&#x1F600;\".length);    \/\/ \u2192 2\uff01 \uff08\u7d75\u6587\u5b57\u3001BMP\u5916\u306eU+1F600\uff09\nconsole.log(\"&#x1F600;&#x1F600;\".length); \/\/ \u2192 4\uff01 \uff08\u7d75\u6587\u5b572\u6587\u5b57\u306a\u306e\u306b4\uff09\n\n\/\/ \u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u4f8b\nconst emoji = \"&#x1F600;\";\nconsole.log(emoji.length);    \/\/ \u2192 2\nconsole.log(emoji[0]);        \/\/ \u2192 '\\uD83D'\uff08\u4e0a\u4f4d\u30b5\u30ed\u30b2\u30fc\u30c8\uff09\nconsole.log(emoji[1]);        \/\/ \u2192 '\\uDE00'\uff08\u4e0b\u4f4d\u30b5\u30ed\u30b2\u30fc\u30c8\uff09\n\n\/\/ \u666e\u901a\u306e\u6587\u5b57\u306flength=1\nconsole.log(\"A\".length);    \/\/ \u2192 1\nconsole.log(\"a\".length);    \/\/ \u2192 1\nconsole.log(\"1\".length);    \/\/ \u2192 1\nconsole.log(\"\u3042\".length);   \/\/ \u2192 1\nconsole.log(\"\u6f22\".length);   \/\/ \u2192 1\uff08BMP\u5185\u306e\u6f22\u5b57\uff09\n\n\/\/ \u6ce8\u610f\u304c\u5fc5\u8981\u306a\u6587\u5b57\u306e\u4f8b\nconsole.log(\"&#x20B9F;\".length); \/\/ \u2192 2\uff08\ud842\udf9f = BMP\u5916\u306e\u6f22\u5b57 \"\u53f1\"\u306e\u65e7\u5b57\u4f53\uff09<\/pre>\n<\/div>\n\n\n\n<div style=\"background:#f8f9fa;border-left:4px solid #6b7280;border-radius:0 8px 8px 0;padding:16px 20px;margin:20px 0;\">\n  <p style=\"margin:0 0 4px;font-size:13px;font-weight:700;color:#6b7280;letter-spacing:1px;\">&#128218; \u7528\u8a9e\u89e3\u8aac<\/p>\n  <p style=\"margin:0;font-size:15px;line-height:1.7;\"><strong>\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\uff08Surrogate Pair\uff09<\/strong>\uff1aUnicode\u6587\u5b57\u3092UTF-16\u3067\u8868\u73fe\u3059\u308b\u3068\u304d\u3001U+FFFF\uff0865535\uff09\u3092\u8d85\u3048\u308b\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u300c\u4e0a\u4f4d\u30b5\u30ed\u30b2\u30fc\u30c8\uff08U+D800\u301cU+DBFF\uff09+ \u4e0b\u4f4d\u30b5\u30ed\u30b2\u30fc\u30c8\uff08U+DC00\u301cU+DFFF\uff09\u300d\u306e2\u3064\u306e16\u30d3\u30c3\u30c8\u5024\u3067\u8868\u73fe\u3059\u308b\u3002\u3053\u306e2\u3064\u7d44\u3092\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u3068\u547c\u3076\u3002JavaScript\u306e\u6587\u5b57\u5217\u306fUTF-16\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u306e\u914d\u5217\u3067\u3042\u308b\u305f\u3081\u3001\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306e\u6587\u5b57\u306f1\u6587\u5b57\u306b\u898b\u3048\u3066\u3082length\u304c2\u306b\u306a\u308b\u3002\u7d75\u6587\u5b57\uff08U+1F000\u756a\u53f0\u306a\u3069\uff09\u306e\u591a\u304f\u306f\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u306b\u8a72\u5f53\u3059\u308b\u3002<\/p>\n<\/div>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ \u3088\u304f\u6df7\u4e71\u3059\u308b\u300c\u898b\u305f\u76ee1\u6587\u5b57\u3060\u304clength=2\u300d\u306e\u4f8b\nconst examples = [\n    [\"A\", \"ASCII\"],\n    [\"\u3042\", \"\u3072\u3089\u304c\u306a\"],\n    [\"\u6f22\", \"BMP\u5185\u6f22\u5b57\"],\n    [\"&#x1F600;\", \"\u7d75\u6587\u5b57\uff08\u7b11\u9854\uff09\"],\n    [\"&#x1F4BB;\", \"\u7d75\u6587\u5b57\uff08\u30ce\u30fc\u30c8PC\uff09\"],\n    [\"&#x1F1EF;&#x1F1F5;\", \"\u56fd\u65d7\uff08\u65e5\u672c\uff09\u2190 ZWJ\u7d50\u5408\u3067\u9577\u30554\uff01\"],\n];\n\nexamples.forEach(([char, label]) => {\n    \/\/ char\u306e\u4e2d\u306e\u7d75\u6587\u5b57\u306fHTML\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u3066\u3044\u308b\u305f\u3081\u5b9f\u969b\u306eJS\u30b3\u30fc\u30c9\u3068\u7570\u306a\u308a\u307e\u3059\n    console.log(label + ': length=' + char.length);\n});<\/pre>\n<\/div>\n\n\n\n<div id=\"sec-04\"><\/div>\n<h2 class=\"section-header-img\" style=\"margin:32px 0 24px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);padding:32px 28px;color:#fff;position:relative;border:none;border-left:none;text-align:left;\">\n  <span class=\"section-number\" style=\"display:block;\">04<\/span>\n  <span class=\"section-label\" style=\"display:block;\">ARRAY_FROM<\/span>\n  <span class=\"section-title\" style=\"display:block;\">Array.from()\u3068\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\u3067\u6b63\u78ba\u306a\u6587\u5b57\u6570\u3092\u53d6\u5f97<\/span>\n  <span class=\"section-desc\">Unicode\u5bfe\u5fdc\u306e\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\u65b9\u6cd53\u9078<\/span>\n<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u7d75\u6587\u5b57\u3092\u542b\u3080\u6587\u5b57\u5217\u3067\u3082\u6b63\u78ba\u306a\u300c\u30e6\u30fc\u30b6\u30fc\u304c\u8a8d\u8b58\u3059\u308b\u6587\u5b57\u6570\u300d\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u306b\u306f\u3001<strong>Array.from()<\/strong>\u307e\u305f\u306f\u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\uff08[...str]\uff09\u3092\u4f7f\u3044\u307e\u3059\u3002\u3053\u308c\u3089\u306fUTF-16\u306e\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u30921\u6587\u5b57\u3068\u3057\u3066\u6271\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div style=\"background:#f8f9fa;border-left:4px solid #6b7280;border-radius:0 8px 8px 0;padding:16px 20px;margin:20px 0;\">\n  <p style=\"margin:0 0 4px;font-size:13px;font-weight:700;color:#6b7280;letter-spacing:1px;\">&#128218; \u7528\u8a9e\u89e3\u8aac<\/p>\n  <p style=\"margin:0;font-size:15px;line-height:1.7;\"><strong>Intl.Segmenter\uff08\u6700\u3082\u6b63\u78ba\u306a\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\uff09<\/strong>\uff1aES2022\u3067\u8ffd\u52a0\u3055\u308c\u305fAPI\u3002\u30c6\u30ad\u30b9\u30c8\u3092Unicode\u306e\u30b0\u30e9\u30d5\u30a7\u30e0\uff08\u66f8\u8a18\u7d20\u30af\u30e9\u30b9\u30bf\u30fc\uff09\u5358\u4f4d\u3067\u5206\u5272\u3059\u308b\u3002\u8907\u6570\u306e\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u304c\u7d44\u307f\u5408\u308f\u3055\u3063\u30661\u6587\u5b57\u306b\u898b\u3048\u308b\u30b1\u30fc\u30b9\uff08\u56fd\u65d7\u306e\u7d75\u6587\u5b57\u30fbZWJ\u7d50\u5408\u306e\u5bb6\u65cf\u7d75\u6587\u5b57\u7b49\uff09\u3082\u6b63\u78ba\u306b1\u6587\u5b57\u3068\u3057\u3066\u30ab\u30a6\u30f3\u30c8\u3067\u304d\u308b\u3002Array.from\u3088\u308a\u6b63\u78ba\u3060\u304c\u3001Node.js 16+\u307e\u305f\u306f\u30e2\u30c0\u30f3\u30d6\u30e9\u30a6\u30b6\u304c\u5fc5\u8981\u3002const segmenter = new Intl.Segmenter(); const segments = [...segmenter.segment(str)]; segments.length\u304c\u6700\u3082\u6b63\u78ba\u306a\u6587\u5b57\u6570\u3002<\/p>\n<\/div>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ \u65b9\u6cd51: Array.from() \u3067Unicode\u5bfe\u5fdc\u306e\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\nconst str1 = \"Hello&#x1F600;\";  \/\/ H-e-l-l-o-\u7d75\u6587\u5b57\n\nconsole.log(str1.length);           \/\/ \u2192 7\uff08\u7d75\u6587\u5b57\u306f2\u3068\u30ab\u30a6\u30f3\u30c8\uff09\nconsole.log(Array.from(str1).length); \/\/ \u2192 6\uff08\u7d75\u6587\u5b57\u30921\u3068\u30ab\u30a6\u30f3\u30c8\uff09\n\n\/\/ \u65b9\u6cd52: \u30b9\u30d7\u30ec\u30c3\u30c9\u69cb\u6587\u3067\u3082\u540c\u3058\u7d50\u679c\nconsole.log([...str1].length);  \/\/ \u2192 6\uff08Array.from\u3068\u540c\u3058\uff09\n\n\/\/ \u65b9\u6cd53: Intl.Segmenter\uff08ES2022\u4ee5\u964d\u30fb\u6700\u3082\u6b63\u78ba\uff09\nconst segmenter = new Intl.Segmenter('ja');\nconst segments = [...segmenter.segment(str1)];\nconsole.log(segments.length);  \/\/ \u2192 6\n\n\/\/ \u3069\u308c\u3092\u4f7f\u3046\u3079\u304d\u304b\n\/\/ - \u901a\u5e38\u306e\u65e5\u672c\u8a9e\u30fb\u82f1\u6570\u5b57\u306e\u307f \u2192 str.length \u3067\u5341\u5206\n\/\/ - \u7d75\u6587\u5b57\u3092\u542b\u3080\u53ef\u80fd\u6027\u304c\u3042\u308b \u2192 Array.from(str).length\n\/\/ - \u56fd\u65d7\u30fb\u5bb6\u65cf\u7d75\u6587\u5b57\u306a\u3069\u8907\u5408\u7d75\u6587\u5b57 \u2192 Intl.Segmenter<\/pre>\n<\/div>\n\n\n\n<div class=\"g-flow-row\" style=\"margin:24px 0;\">\n  <div class=\"g-flow-item\"><strong>\u7d75\u6587\u5b57\u3092\u542b\u307e\u306a\u3044<\/strong><br><span style=\"font-size:12px;\">\u65e5\u672c\u8a9e\u30fb\u82f1\u6570\u5b57\u306e\u307f<br>str.length \u3067\u5341\u5206<\/span><\/div>\n  <div class=\"g-flow-arrow\">&#8594;<\/div>\n  <div class=\"g-flow-item\"><strong>\u7d75\u6587\u5b57\u3092\u542b\u3080\u53ef\u80fd\u6027\u3042\u308a<\/strong><br><span style=\"font-size:12px;\">Array.from(str).length<br>\u30b9\u30d7\u30ec\u30c3\u30c9[...str].length<\/span><\/div>\n  <div class=\"g-flow-arrow\">&#8594;<\/div>\n  <div class=\"g-flow-item\"><strong>\u56fd\u65d7\u30fb\u8907\u5408\u7d75\u6587\u5b57\u3042\u308a<\/strong><br><span style=\"font-size:12px;\">Intl.Segmenter<br>\uff08ES2022+\uff09<\/span><\/div>\n<\/div>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ \u5b9f\u7528\u7684\u306a\u300c\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\u95a2\u6570\u300d\nfunction countChars(str) {\n  \/\/ Intl.Segmenter\u304c\u4f7f\u3048\u308c\u3070\u4f7f\u3046\uff08\u6700\u3082\u6b63\u78ba\uff09\n  if (typeof Intl.Segmenter !== 'undefined') {\n    const segmenter = new Intl.Segmenter();\n    return [...segmenter.segment(str)].length;\n  }\n  \/\/ \u30d5\u30a9\u30fc\u30eb\u30d0\u30c3\u30af: Array.from\uff08\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u5bfe\u5fdc\uff09\n  return Array.from(str).length;\n}\n\nconsole.log(countChars(\"Hello\"));        \/\/ \u2192 5\nconsole.log(countChars(\"\u3053\u3093\u306b\u3061\u306f\"));   \/\/ \u2192 5\nconsole.log(countChars(\"Hi&#x1F600;\"));         \/\/ \u2192 3\uff08\u7d75\u6587\u5b571\u6587\u5b57\uff09<\/pre>\n<\/div>\n\n\n\n<div id=\"sec-05\"><\/div>\n<h2 class=\"section-header-img\" style=\"margin:32px 0 24px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);padding:32px 28px;color:#fff;position:relative;border:none;border-left:none;text-align:left;\">\n  <span class=\"section-number\" style=\"display:block;\">05<\/span>\n  <span class=\"section-label\" style=\"display:block;\">ARRAY<\/span>\n  <span class=\"section-title\" style=\"display:block;\">\u914d\u5217\u306elength\uff1a\u8981\u7d20\u6570\u306e\u53d6\u5f97\u3068\u914d\u5217\u306e\u672b\u5c3e\u51e6\u7406<\/span>\n  <span class=\"section-desc\">\u8981\u7d20\u6570\u306e\u53d6\u5f97\u30fb\u672b\u5c3e\u8ffd\u52a0\u30fbsplice\u30fb\u914d\u5217\u521d\u671f\u5316\u306e\u30d1\u30bf\u30fc\u30f3<\/span>\n<\/h2>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ \u914d\u5217\u306elength\u306e\u57fa\u672c\nconst fruits = ['apple', 'banana', 'cherry'];\nconsole.log(fruits.length);  \/\/ \u2192 3\n\n\/\/ \u7a7a\u914d\u5217\nconsole.log([].length);  \/\/ \u2192 0\n\n\/\/ \u914d\u5217\u306e\u6700\u5f8c\u306e\u8981\u7d20\u3092\u53d6\u5f97\uff08length-1\u304c\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\uff09\nconsole.log(fruits[fruits.length - 1]);  \/\/ \u2192 'cherry'\n\/\/ \u307e\u305f\u306f\uff08ES2022+\uff09\nconsole.log(fruits.at(-1));  \/\/ \u2192 'cherry'\n\n\/\/ \u914d\u5217\u306b\u8981\u7d20\u3092\u8ffd\u52a0\u3057\u3066length\u304c\u5909\u308f\u308b\nfruits.push('date');\nconsole.log(fruits.length);  \/\/ \u2192 4\n\n\/\/ \u914d\u5217\u306e\u672b\u5c3e\u3092\u524a\u9664\u3057\u3066length\u304c\u5909\u308f\u308b\nfruits.pop();\nconsole.log(fruits.length);  \/\/ \u2192 3\n\n\/\/ length\u3092\u76f4\u63a5\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u308b\uff08\u8981\u7d20\u306e\u524a\u9664\uff09\nfruits.length = 2;\nconsole.log(fruits);  \/\/ \u2192 ['apple', 'banana']\uff08cherry\u4ee5\u964d\u304c\u524a\u9664\uff09\n\n\/\/ length=0 \u3067\u914d\u5217\u3092\u7a7a\u306b\u3059\u308b\nfruits.length = 0;\nconsole.log(fruits);  \/\/ \u2192 []\uff08\u5168\u8981\u7d20\u524a\u9664\u30fb\u540c\u3058\u53c2\u7167\u3092\u7dad\u6301\uff09<\/pre>\n<\/div>\n\n\n\n<div style=\"background:#f0fdf4;border:1px solid #22c55e;border-radius:8px;padding:20px 24px;margin:24px 0;\">\n  <div style=\"display:flex;align-items:center;gap:8px;margin-bottom:12px;\">\n    <span style=\"font-size:18px;\">&#128161;<\/span>\n    <strong style=\"color:#16a34a;font-size:15px;\">\u914d\u5217\u3092\u7a7a\u306b\u3059\u308b3\u3064\u306e\u65b9\u6cd5\u3068\u305d\u306e\u9055\u3044<\/strong>\n  <\/div>\n  <p style=\"margin:0;font-size:15px;line-height:1.8;color:#333;\">\u2460arr.length = 0: \u914d\u5217\u306e\u9577\u3055\u30920\u306b\u3059\u308b\u3002\u5143\u306e\u914d\u5217\u306e\u53c2\u7167\u304c\u7dad\u6301\u3055\u308c\u308b\u305f\u3081\u4ed6\u306e\u5909\u6570\u304c\u540c\u3058\u914d\u5217\u3092\u53c2\u7167\u3057\u3066\u3044\u3066\u3082\u7a7a\u306b\u306a\u308b\u3002\u2461arr = []: \u65b0\u3057\u3044\u7a7a\u914d\u5217\u3092\u5909\u6570\u306b\u4ee3\u5165\u3002\u4ed6\u306e\u5909\u6570\u304carr.\u3092\u53c2\u7167\u3057\u3066\u3044\u305f\u5834\u5408\u306f\u5f71\u97ff\u3057\u306a\u3044\u3002\u2462arr.splice(0): \u5168\u8981\u7d20\u3092\u524a\u9664\u3002\u53c2\u7167\u306f\u7dad\u6301\u3002\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306flength=0\u304c\u6700\u901f\u3067\u3001arr=[]\u306f\u53c2\u7167\u3092\u65b0\u3057\u304f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306b\u4f7f\u3046\u3002<\/p>\n<\/div>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ \u914d\u5217length\u3092\u4f7f\u3063\u305f\u5b9f\u7528\u30d1\u30bf\u30fc\u30f3\n\n\/\/ 1. \u30eb\u30fc\u30d7\u306e\u7d42\u4e86\u6761\u4ef6\nconst numbers = [10, 20, 30, 40, 50];\nfor (let i = 0; i < numbers.length; i++) {\n  console.log(numbers[i]);\n}\n\n\/\/ 2. \u914d\u5217\u304c\u7a7a\u304b\u30c1\u30a7\u30c3\u30af\nconst cart = [];\nif (cart.length === 0) {\n  console.log(\"\u30ab\u30fc\u30c8\u306f\u7a7a\u3067\u3059\");\n}\n\n\/\/ 3. \u914d\u5217\u306eN\u756a\u76ee\u304b\u3089\u672b\u5c3e\u307e\u3067\u53d6\u5f97\nconst top3 = numbers.slice(0, 3);      \/\/ \u5148\u982d3\u4ef6\nconst last2 = numbers.slice(-2);        \/\/ \u672b\u5c3e2\u4ef6\nconst mid = numbers.slice(1, numbers.length - 1);  \/\/ \u5148\u982d\u30fb\u672b\u5c3e\u3092\u9664\u304f\n\n\/\/ 4. \u6700\u5927\u8981\u7d20\u6570\u306e\u5236\u9650\nconst MAX_ITEMS = 3;\nif (numbers.length > MAX_ITEMS) {\n  numbers.length = MAX_ITEMS;  \/\/ 3\u4ef6\u306b\u5207\u308a\u8a70\u3081\n  console.log(numbers);  \/\/ \u2192 [10, 20, 30]\n}<\/pre>\n<\/div>\n\n\n\n<div id=\"sec-06\"><\/div>\n<h2 class=\"section-header-img\" style=\"margin:32px 0 24px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);padding:32px 28px;color:#fff;position:relative;border:none;border-left:none;text-align:left;\">\n  <span class=\"section-number\" style=\"display:block;\">06<\/span>\n  <span class=\"section-label\" style=\"display:block;\">FUNCTION<\/span>\n  <span class=\"section-title\" style=\"display:block;\">\u95a2\u6570\u306elength\uff1a\u5f15\u6570\u306e\u6570\u3092\u78ba\u8a8d\u3059\u308b<\/span>\n  <span class=\"section-desc\">\u5b9a\u7fa9\u3055\u308c\u305f\u4eee\u5f15\u6570\u306e\u6570\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u5f15\u6570\u30fbrest\u5f15\u6570\u306e\u6271\u3044\uff09<\/span>\n<\/h2>\n\n\n\n<div style=\"background:#f8f9fa;border-left:4px solid #6b7280;border-radius:0 8px 8px 0;padding:16px 20px;margin:20px 0;\">\n  <p style=\"margin:0 0 4px;font-size:13px;font-weight:700;color:#6b7280;letter-spacing:1px;\">&#128218; \u7528\u8a9e\u89e3\u8aac<\/p>\n  <p style=\"margin:0;font-size:15px;line-height:1.7;\"><strong>Function.length \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\uff1a\u95a2\u6570\u306e\u5b9a\u7fa9\u3055\u308c\u305f\u4eee\u5f15\u6570\uff08\u30d1\u30e9\u30e1\u30fc\u30bf\uff09\u306e\u6570\u3092\u8fd4\u3059\u3002\u6ce8\u610f\u70b9\u3068\u3057\u3066\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u3042\u308b\u5f15\u6570\uff08function f(a, b = 1)\uff09\u306f\u30ab\u30a6\u30f3\u30c8\u3055\u308c\u306a\u3044\uff08f.length = 1\uff09\u3002rest\u5f15\u6570\uff08...args\uff09\u3082\u30ab\u30a6\u30f3\u30c8\u3055\u308c\u306a\u3044\uff08function f(a, ...rest)\u306a\u3089f.length = 1\uff09\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306a\u3057\u30fbrest\u5f15\u6570\u306a\u3057\u306e\u5f15\u6570\u3060\u3051\u304c\u30ab\u30a6\u30f3\u30c8\u3055\u308c\u308b\u3002\u4e3b\u306bHOF\uff08\u9ad8\u968e\u95a2\u6570\uff09\u3084\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u5b9f\u88c5\u3067\u5f15\u6570\u306e\u6570\u306b\u3088\u3063\u3066\u52d5\u4f5c\u3092\u5909\u3048\u305f\u3044\u3068\u304d\u306b\u4f7f\u3046\u3002<\/p>\n<\/div>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ \u95a2\u6570\u306elength\nfunction greet(name, greeting) {\n  return greeting + ', ' + name;\n}\nconsole.log(greet.length);  \/\/ \u2192 2\n\n\/\/ \u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u3042\u308b\u5f15\u6570\u306f\u30ab\u30a6\u30f3\u30c8\u3055\u308c\u306a\u3044\nfunction add(a, b = 0) {\n  return a + b;\n}\nconsole.log(add.length);  \/\/ \u2192 1\uff08b\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u3042\u308b\u306e\u3067\u30ab\u30a6\u30f3\u30c8\u5916\uff09\n\n\/\/ rest\u5f15\u6570\u306f\u30ab\u30a6\u30f3\u30c8\u3055\u308c\u306a\u3044\nfunction sum(first, ...rest) {\n  return rest.reduce((acc, n) => acc + n, first);\n}\nconsole.log(sum.length);  \/\/ \u2192 1\uff08first\u306e\u307f\u30ab\u30a6\u30f3\u30c8\uff09\n\n\/\/ \u30a2\u30ed\u30fc\u95a2\u6570\u3082\u540c\u69d8\nconst multiply = (x, y) => x * y;\nconsole.log(multiply.length);  \/\/ \u2192 2\n\n\/\/ \u5b9f\u7528\u4f8b: \u5f15\u6570\u306e\u6570\u306b\u3088\u3063\u3066\u52d5\u4f5c\u3092\u5909\u3048\u308b\u95a2\u6570\uff08\u30ab\u30ea\u30fc\u5316\u306e\u4f8b\uff09\nfunction curry(fn) {\n  return function curried(...args) {\n    if (args.length >= fn.length) {\n      return fn(...args);  \/\/ \u5f15\u6570\u304c\u63c3\u3063\u305f\u3089\u5b9f\u884c\n    }\n    return function(...moreArgs) {\n      return curried(...args, ...moreArgs);  \/\/ \u5f15\u6570\u304c\u8db3\u308a\u306a\u3051\u308c\u3070\u5f85\u6a5f\n    };\n  };\n}\n\nconst curriedAdd = curry((a, b, c) => a + b + c);\nconsole.log(curriedAdd(1)(2)(3));  \/\/ \u2192 6\nconsole.log(curriedAdd(1, 2)(3));  \/\/ \u2192 6<\/pre>\n<\/div>\n\n\n\n<div id=\"sec-07\"><\/div>\n<h2 class=\"section-header-img\" style=\"margin:32px 0 24px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);padding:32px 28px;color:#fff;position:relative;border:none;border-left:none;text-align:left;\">\n  <span class=\"section-number\" style=\"display:block;\">07<\/span>\n  <span class=\"section-label\" style=\"display:block;\">PRACTICAL<\/span>\n  <span class=\"section-title\" style=\"display:block;\">length\u3092\u4f7f\u3063\u305f\u5b9f\u52d9\u30d1\u30bf\u30fc\u30f3<\/span>\n  <span class=\"section-desc\">\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30fb\u30eb\u30fc\u30d7\u30fb\u6761\u4ef6\u5206\u5c90\u3067\u306e\u5178\u578b\u7684\u306a\u4f7f\u3044\u65b9<\/span>\n<\/h2>\n\n\n\n<div style=\"background:#1e1e1e;border-radius:8px;padding:20px 24px;margin:20px 0;overflow-x:auto;\">\n  <pre style=\"margin:0;color:#d4d4d4;font-size:13px;line-height:1.8;font-family:'Consolas','Courier New',monospace;white-space:pre;\">\/\/ 1. \u5165\u529b\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\uff08\u30d1\u30b9\u30ef\u30fc\u30c9\u5f37\u5ea6\u30c1\u30a7\u30c3\u30af\uff09\nfunction validatePassword(password) {\n  const MIN = 8, MAX = 50;\n  if (password.length < MIN) {\n    return `\u30d1\u30b9\u30ef\u30fc\u30c9\u306f${MIN}\u6587\u5b57\u4ee5\u4e0a\u5fc5\u8981\u3067\u3059\uff08\u73fe\u5728: ${password.length}\u6587\u5b57\uff09`;\n  }\n  if (password.length > MAX) {\n    return `\u30d1\u30b9\u30ef\u30fc\u30c9\u306f${MAX}\u6587\u5b57\u4ee5\u4e0b\u306b\u3057\u3066\u304f\u3060\u3055\u3044`;\n  }\n  return 'OK';\n}\nconsole.log(validatePassword(\"abc\"));        \/\/ \u2192 8\u6587\u5b57\u4ee5\u4e0a\u5fc5\u8981\nconsole.log(validatePassword(\"secure1234\")); \/\/ \u2192 OK\n\n\/\/ 2. \u6587\u5b57\u6570\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u8868\u793a\uff08\u30c6\u30ad\u30b9\u30c8\u30a8\u30ea\u30a2\uff09\n\/\/ document.querySelector('#tweet').addEventListener('input', (e) => {\n\/\/   const remaining = 140 - [...e.target.value].length;  \/\/ \u7d75\u6587\u5b57\u5bfe\u5fdc\n\/\/   document.querySelector('#counter').textContent = remaining + '\u6587\u5b57\u6b8b\u308a';\n\/\/ });\n\n\/\/ 3. \u914d\u5217\u306e\u30c1\u30e3\u30f3\u30af\u51e6\u7406\uff08\u5927\u91cf\u30c7\u30fc\u30bf\u3092\u5206\u5272\uff09\nfunction chunk(arr, size) {\n  const result = [];\n  for (let i = 0; i < arr.length; i += size) {\n    result.push(arr.slice(i, i + size));\n  }\n  return result;\n}\nconsole.log(chunk([1,2,3,4,5,6,7], 3));\n\/\/ \u2192 [[1,2,3],[4,5,6],[7]]\n\n\/\/ 4. \u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\uff08\u5168\u30da\u30fc\u30b8\u6570\u306e\u8a08\u7b97\uff09\nconst items = new Array(95).fill(0);  \/\/ 95\u4ef6\u306e\u30c7\u30fc\u30bf\nconst PAGE_SIZE = 10;\nconst totalPages = Math.ceil(items.length \/ PAGE_SIZE);\nconsole.log(totalPages);  \/\/ \u2192 10\u30da\u30fc\u30b8\n\n\/\/ 5. \u6587\u5b57\u5217\u306e\u53f3\u7aef\u3092N\u6587\u5b57\u30de\u30b9\u30af\uff08\u30af\u30ec\u30ab\u756a\u53f7\u7b49\uff09\nfunction maskEnd(str, visibleStart = 4) {\n  const len = Array.from(str).length;  \/\/ Unicode\u5bfe\u5fdc\n  return str.slice(0, visibleStart) + '*'.repeat(Math.max(0, len - visibleStart));\n}\nconsole.log(maskEnd(\"1234567890123456\"));  \/\/ \u2192 1234************<\/pre>\n<\/div>\n\n\n\n<div class=\"g-flow-row\" style=\"margin:24px 0;\">\n  <div class=\"g-flow-item\"><strong>\u30c6\u30ad\u30b9\u30c8\u5165\u529b\u30d5\u30a9\u30fc\u30e0<\/strong><br><span style=\"font-size:12px;\">\u30e6\u30fc\u30b6\u30fc\u304c\u5165\u529b<\/span><\/div>\n  <div class=\"g-flow-arrow\">&#8594;<\/div>\n  <div class=\"g-flow-item\"><strong>[...str].length \u3067\u6587\u5b57\u6570\u53d6\u5f97<\/strong><br><span style=\"font-size:12px;\">\u7d75\u6587\u5b57\u5bfe\u5fdc\u306e\u6b63\u78ba\u306a\u6570<\/span><\/div>\n  <div class=\"g-flow-arrow\">&#8594;<\/div>\n  <div class=\"g-flow-item\"><strong>\u6700\u5927\/\u6700\u5c0f\u6587\u5b57\u6570\u30c1\u30a7\u30c3\u30af<\/strong><br><span style=\"font-size:12px;\">if (len > MAX) \u30a8\u30e9\u30fc\u8868\u793a<\/span><\/div>\n  <div class=\"g-flow-arrow\">&#8594;<\/div>\n  <div class=\"g-flow-item\"><strong>\u6b8b\u308a\u6587\u5b57\u6570\u3092\u8868\u793a<\/strong><br><span style=\"font-size:12px;\">MAX - len \u3092UI\u306b\u53cd\u6620<\/span><\/div>\n<\/div>\n\n\n\n<div id=\"sec-08\"><\/div>\n<h2 class=\"section-header-img\" style=\"margin:32px 0 24px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);padding:32px 28px;color:#fff;position:relative;border:none;border-left:none;text-align:left;\">\n  <span class=\"section-number\" style=\"display:block;\">08<\/span>\n  <span class=\"section-label\" style=\"display:block;\">AI_ASSIST<\/span>\n  <span class=\"section-title\" style=\"display:block;\">Claude Code\u3067length\u306eJavaScript\u30b3\u30fc\u30c9\u3092\u81ea\u52d5\u751f\u6210\u3059\u308b<\/span>\n  <span class=\"section-desc\">\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\u30fb\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30fbUnicode\u5bfe\u5fdc\u30b3\u30fc\u30c9\u304c\u5373\u751f\u6210<\/span>\n<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Claude Code<\/strong>\u3092\u4f7f\u3048\u3070\u3001length\u3092\u4f7f\u3063\u305f\u6587\u5b57\u6570\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30fb\u914d\u5217\u51e6\u7406\u30fbUnicode\u5bfe\u5fdc\u30ab\u30a6\u30f3\u30c8\u306e\u30b3\u30fc\u30c9\u304c\u65e5\u672c\u8a9e\u3067\u6307\u793a\u3059\u308b\u3060\u3051\u3067\u5373\u5ea7\u306b\u751f\u6210\u3055\u308c\u307e\u3059\u3002\u7d75\u6587\u5b57\u5bfe\u5fdc\u304c\u5fc5\u8981\u304b\u3069\u3046\u304b\u3082\u300c\u7d75\u6587\u5b57\u3092\u542b\u3080\u53ef\u80fd\u6027\u304c\u3042\u308b\u300d\u3068\u4f1d\u3048\u308b\u3060\u3051\u3067\u81ea\u52d5\u7684\u306bArray.from\u3092\u4f7f\u3063\u305f\u30b3\u30fc\u30c9\u304c\u8fd4\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<table>\n<thead><tr><th>\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/th><th>Claude Code\u3078\u306e\u6307\u793a\u4f8b<\/th><\/tr><\/thead>\n<tbody>\n<tr><td>\u6587\u5b57\u6570\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3<\/td><td>\u300cJavaScript\u3067\u5165\u529b\u6587\u5b57\u5217\u3092\u53d7\u3051\u53d6\u308a\u300110\u301c200\u6587\u5b57\u306e\u7bc4\u56f2\u304b\u30c1\u30a7\u30c3\u30af\u3057\u3066\u7bc4\u56f2\u5916\u306a\u3089\u65e5\u672c\u8a9e\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8fd4\u3059\u95a2\u6570\u3092\u66f8\u3044\u3066\u3002\u7d75\u6587\u5b57\u5bfe\u5fdc\u304c\u5fc5\u8981\u3002\u300d<\/td><\/tr>\n<tr><td>\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8<\/td><td>\u300c\u30c6\u30ad\u30b9\u30c8\u30a8\u30ea\u30a2\u306e\u5165\u529b\u306b\u5408\u308f\u305b\u3066\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u6b8b\u308a\u6587\u5b57\u6570\u3092\u8868\u793a\u3059\u308bVanilla JS\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3002\u6700\u5927140\u6587\u5b57\u3002\u7d75\u6587\u5b57\u30821\u6587\u5b57\u3068\u3057\u3066\u30ab\u30a6\u30f3\u30c8\u3002\u300d<\/td><\/tr>\n<tr><td>\u914d\u5217\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3<\/td><td>\u300cJavaScript\u3067\u914d\u5217\u3068\u30da\u30fc\u30b8\u30b5\u30a4\u30ba\u3092\u53d7\u3051\u53d6\u308a\u3001\u5168\u30da\u30fc\u30b8\u6570\u3068\u30da\u30fc\u30b8\u3054\u3068\u306e\u30c7\u30fc\u30bf\u3092\u8fd4\u3059paginate\u95a2\u6570\u3092\u66f8\u3044\u3066\u3002\u300d<\/td><\/tr>\n<tr><td>\u672b\u5c3e\u30de\u30b9\u30af<\/td><td>\u300cJavaScript\u3067\u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u756a\u53f7\u6587\u5b57\u5217\u306e\u5f8c\u308d12\u6841\u3092\u30a2\u30b9\u30bf\u30ea\u30b9\u30af\u3067\u30de\u30b9\u30af\u3059\u308b\u95a2\u6570\u3002\u5148\u982d4\u6841\u306f\u8868\u793a\u3002\u6587\u5b57\u5217\u9577\u306flength\u3092\u4f7f\u3063\u3066\u8a08\u7b97\u3002\u300d<\/td><\/tr>\n<\/tbody>\n<\/table>\n\n\n\n<div class=\"balloon-wrap\">\n  <div class=\"balloon-icon\">\n    <img decoding=\"async\" src=\"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-content\/uploads\/2026\/04\/ceo-sugasawa.jpg\" alt=\"\u4ee3\u8868\u83c5\u6fa4\">\n    <span class=\"balloon-name\">\u4ee3\u8868\u83c5\u6fa4<\/span>\n  <\/div>\n  <div class=\"balloon-body\">Claude Code\u306b\u300c\u7d75\u6587\u5b57\u3092\u542b\u3080\u53ef\u80fd\u6027\u304c\u3042\u308b\u6587\u5b57\u5217\u306e\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\u300d\u3068\u4f1d\u3048\u308b\u3068\u3001\u81ea\u52d5\u7684\u306bArray.from()\u307e\u305f\u306fIntl.Segmenter\u3092\u4f7f\u3063\u305fUnicode\u5bfe\u5fdc\u306e\u30b3\u30fc\u30c9\u3092\u751f\u6210\u3057\u3066\u304f\u308c\u307e\u3059\u3002\u300cstr.length\u3067\u5341\u5206\u3067\u3059\u304b\uff1f\u300d\u3068\u805e\u3044\u3066\u304f\u308b\u5834\u5408\u3082\u3042\u308b\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u5165\u529b\u306b\u7d75\u6587\u5b57\u3092\u542b\u3080\u53ef\u80fd\u6027\u304c\u3042\u308b\u304b\u3092\u660e\u793a\u3059\u308b\u3068\u52b9\u7387\u7684\u3067\u3059\u3002<\/div>\n<\/div>\n\n\n\n<div style=\"background:#f8f9fa;border-left:4px solid #6b7280;border-radius:0 8px 8px 0;padding:16px 20px;margin:20px 0;\">\n  <p style=\"margin:0 0 4px;font-size:13px;font-weight:700;color:#6b7280;letter-spacing:1px;\">&#128218; \u7528\u8a9e\u89e3\u8aac<\/p>\n  <p style=\"margin:0;font-size:15px;line-height:1.7;\"><strong>UTF-16\uff08Unicode Transformation Format 16-bit\uff09<\/strong>\uff1aUnicode\u3092\u30a8\u30f3\u30b3\u30fc\u30c9\u3059\u308b\u65b9\u5f0f\u306e\u4e00\u3064\u3002JavaScript\u304c\u5185\u90e8\u3067\u4f7f\u7528\u3059\u308b\u6587\u5b57\u30b3\u30fc\u30c9\u3002U+0000\u301cU+FFFF\u306e\u57fa\u672c\u591a\u8a00\u8a9e\u9762\uff08BMP\uff09\u306e\u6587\u5b57\u306f16\u30d3\u30c3\u30c8\uff082\u30d0\u30a4\u30c8\uff091\u5358\u4f4d\u3067\u8868\u73fe\u3057\u3001\u305d\u308c\u3088\u308a\u5927\u304d\u306a\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\uff08\u7d75\u6587\u5b57\u306a\u3069\uff09\u306f\u4e0a\u4f4d\u30b5\u30ed\u30b2\u30fc\u30c8\u3068\u4e0b\u4f4d\u30b5\u30ed\u30b2\u30fc\u30c8\u306e2\u5358\u4f4d\uff08\u5408\u8a084\u30d0\u30a4\u30c8\uff09\u3067\u8868\u73fe\u3059\u308b\u3002str.length\u306fUTF-16\u306e\u300c\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u6570\u300d\u3092\u8fd4\u3059\u305f\u3081\u3001\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u6587\u5b57\u3092\u542b\u3080\u5834\u5408\u306f\u898b\u305f\u76ee\u306e\u6587\u5b57\u6570\u3088\u308a\u5927\u304d\u304f\u306a\u308b\u3002JavaScript\u306eString.prototype.charCodeAt()\u306fUTF-16\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u3092\u8fd4\u3057\u3001codePointAt()\u306fUnicode\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u8fd4\u3059\u3002<\/p>\n<\/div>\n\n\n\n<div id=\"sec-09\"><\/div>\n<h2 class=\"section-header-img\" style=\"margin:32px 0 24px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);padding:32px 28px;color:#fff;position:relative;border:none;border-left:none;text-align:left;\">\n  <span class=\"section-number\" style=\"display:block;\">09<\/span>\n  <span class=\"section-label\" style=\"display:block;\">CONCLUSION<\/span>\n  <span class=\"section-title\" style=\"display:block;\">\u307e\u3068\u3081\uff1aJavaScript length\u306e\u91cd\u8981\u30dd\u30a4\u30f3\u30c8<\/span>\n  <span class=\"section-desc\">\u6587\u5b57\u5217\u30fb\u914d\u5217\u30fbUnicode\u306e3\u3064\u3092\u62bc\u3055\u3048\u308c\u3070\u5b8c\u74a7<\/span>\n<\/h2>\n\n\n\n<div style=\"background:#fafafa;border-radius:8px;padding:16px 20px;margin:16px 0;border-left:4px solid #dc2626;\">\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span>length\u306f\u30d7\u30ed\u30d1\u30c6\u30a3\uff08\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u306a\u3044\uff09\u3002<strong>\u62ec\u5f27\u4e0d\u8981<\/strong>\uff08str.length()\u306f\u30a8\u30e9\u30fc\uff09<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>\u6587\u5b57\u5217\u306elength<\/strong>\u306fUTF-16\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u6570\u3002\u65e5\u672c\u8a9e\u306f1\u6587\u5b57=1<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>\u7d75\u6587\u5b57\u30fb\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2<\/strong>\u306f1\u6587\u5b57\u306b\u898b\u3048\u3066length=2\u3002Array.from()\u3067\u5bfe\u5fdc<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span>\u6b63\u78ba\u306a\u6587\u5b57\u6570\u306f<strong>Array.from(str).length<\/strong>\u307e\u305f\u306f[...str].length<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span>\u6700\u3082\u6b63\u78ba\u306a\u30ab\u30a6\u30f3\u30c8\u306f<strong>Intl.Segmenter<\/strong>\uff08\u56fd\u65d7\u30fb\u8907\u5408\u7d75\u6587\u5b57\u5bfe\u5fdc\uff09<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>\u914d\u5217\u306elength<\/strong>=0\u3067\u5168\u8981\u7d20\u524a\u9664\u30fb\u914d\u5217\u3092\u7a7a\u306b\u3067\u304d\u308b<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span><strong>\u95a2\u6570\u306elength<\/strong>\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u30fbrest\u5f15\u6570\u3092\u9664\u3044\u305f\u4eee\u5f15\u6570\u306e\u6570<\/span><\/div>\n<div style=\"display:flex;align-items:flex-start;gap:8px;padding:6px 0;font-size:15px;line-height:1.6;\"><span style=\"color:#dc2626;font-size:16px;flex-shrink:0;margin-top:2px;\">&#10004;&#65039;<\/span><span>Claude Code\u306b\u300c\u7d75\u6587\u5b57\u5bfe\u5fdc\u304c\u5fc5\u8981\u300d\u3068\u4f1d\u3048\u308b\u3068<strong>Unicode\u5b89\u5168\u306a\u30b3\u30fc\u30c9<\/strong>\u304c\u81ea\u52d5\u751f\u6210<\/span><\/div>\n\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">JavaScript\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092AI\u3067\u52b9\u7387\u5316\u3057\u305f\u3044\u65b9\u3078<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">length\u306b\u9650\u3089\u305a\u3001\u6587\u5b57\u5217\u51e6\u7406\u30fb\u914d\u5217\u64cd\u4f5c\u30fb\u30d5\u30a9\u30fc\u30e0\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306fClaude Code\u3068\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u5927\u5e45\u306b\u52b9\u7387\u5316\u3067\u304d\u307e\u3059\u3002<br>AI\u9b3c\u7ba1\u7406\u3067\u306f\u3001JavaScript\/Web\u30a2\u30d7\u30ea\u958b\u767a\u306eAI\u6d3b\u7528\u8a2d\u8a08\u30fb\u5b9f\u88c5\u652f\u63f4\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"balloon-wrap\">\n  <div class=\"balloon-icon\">\n    <img decoding=\"async\" src=\"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-content\/uploads\/2026\/04\/ceo-sugasawa.jpg\" alt=\"\u4ee3\u8868\u83c5\u6fa4\">\n    <span class=\"balloon-name\">\u4ee3\u8868\u83c5\u6fa4<\/span>\n  <\/div>\n  <div class=\"balloon-body\">\u300c\u7d75\u6587\u5b57\u3092\u542b\u3080\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\u304c\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u300d\u300clength\u304c\u671f\u5f85\u901a\u308a\u306e\u5024\u3092\u8fd4\u3055\u306a\u3044\u300d\u3068\u3044\u3046\u76f8\u8ac7\u306f\u983b\u7e41\u306b\u3042\u308a\u307e\u3059\u3002\u30b3\u30fc\u30c9\u3092Claude Code\u306b\u8cbc\u308b\u3060\u3051\u3067\u539f\u56e0\u3068\u4fee\u6b63\u30b3\u30fc\u30c9\u304c\u8fd4\u3063\u3066\u304d\u307e\u3059\u3002\u307e\u305a\u306f\u7121\u6599\u76f8\u8ac7\u3067\u304a\u6c17\u8efd\u306b\u3069\u3046\u305e\u3002<\/div>\n<\/div>\n\n\n\n<div style=\"background:linear-gradient(135deg,#1a1a1a 0%,#2a1015 100%);border-radius:16px;padding:36px 32px;margin:48px 0 16px;color:#fff;\">\n  <p style=\"font-size:13px;font-weight:700;color:#dc2626;letter-spacing:2px;margin:0 0 12px;\">NEXT STEP<\/p>\n  <p style=\"font-size:22px;font-weight:800;line-height:1.5;margin:0 0 20px;\">\u3053\u306e\u8a18\u4e8b\u306e\u5185\u5bb9\u3092\u3001\u3042\u306a\u305f\u306e\u30d3\u30b8\u30cd\u30b9\u3067<br>\u5b9f\u8df5\u3057\u3066\u307f\u307e\u305b\u3093\u304b\uff1f<\/p>\n  <div style=\"background:rgba(255,255,255,0.06);border:1px solid rgba(255,255,255,0.12);border-radius:12px;padding:24px;max-width:560px;margin:0 auto;\">\n    <p style=\"font-size:13px;color:#dc2626;font-weight:700;margin:0 0 8px;\">AI\u6d3b\u7528\u3092\u81ea\u793e\u3067\u56de\u305b\u308b\u3088\u3046\u306b\u306a\u308a\u305f\u3044\u65b9\u3078<\/p>\n    <p style=\"font-size:20px;font-weight:800;margin:0 0 12px;\">AI\u9b3c\u7ba1\u7406<\/p>\n    <p style=\"font-size:14px;color:rgba(255,255,255,0.75);margin:0 0 20px;line-height:1.7;\">Claude Code\u30fbCowork\u5c0e\u5165\u652f\u63f4\u304b\u3089\u696d\u52d9\u8a2d\u8a08\u30fb\u793e\u5185\u6d78\u900f\u307e\u3067\u5b9f\u8df5\u30d9\u30fc\u30b9\u3067\u4f34\u8d70\u3002\u300c\u81ea\u793e\u3067\u56de\u305b\u308b\u7d44\u7e54\u300d\u309290\u65e5\u3067\u4f5c\u308b\u7d4c\u55b6\u8005\u5411\u3051\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3002<\/p>\n    <div style=\"text-align:center;\">\n      <a href=\"https:\/\/aikanri.genai-ai.co.jp\/?utm_source=blog&utm_medium=article&utm_campaign=cc-js-length&utm_content=next-step-cta\" target=\"_blank\" rel=\"noopener\" style=\"display:inline-block;background:#dc2626;color:#fff;font-weight:700;font-size:15px;padding:14px 32px;border-radius:30px;text-decoration:none;\">AI\u9b3c\u7ba1\u7406\u3092\u8a73\u3057\u304f\u898b\u308b \u2192<\/a>\n    <\/div>\n  <\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"faq\">\u3088\u304f\u3042\u308b\u8cea\u554f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Q. JavaScript\u3067length\u306f\u3069\u3046\u3084\u3063\u3066\u4f7f\u3044\u307e\u3059\u304b\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A. length\u306fJavaScript\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\uff08\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u306a\u3044\uff09\u306a\u306e\u3067\u3001\u62ec\u5f27\u306a\u3057\u3067\u4f7f\u3044\u307e\u3059\u3002\u6587\u5b57\u5217\u306a\u3089 str.length\u3001\u914d\u5217\u306a\u3089 arr.length \u3068\u66f8\u304d\u307e\u3059\u3002str.length()\u306e\u3088\u3046\u306b\u62ec\u5f27\u3092\u4ed8\u3051\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u6587\u5b57\u5217\u3067\u306f\u6587\u5b57\u6570\uff08UTF-16\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u6570\uff09\u3001\u914d\u5217\u3067\u306f\u8981\u7d20\u6570\u304c\u8fd4\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Q. JavaScript\u3067\u6587\u5b57\u5217\u306e\u6587\u5b57\u6570\u3092\u6b63\u78ba\u306b\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u3044\u3002length\u3067\u306f\u7d75\u6587\u5b57\u304c2\u306b\u306a\u308a\u307e\u3059\u3002<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A. JavaScript\u306e\u6587\u5b57\u5217\u306fUTF-16\u3067\u7ba1\u7406\u3055\u308c\u3066\u304a\u308a\u3001\u7d75\u6587\u5b57\u306a\u3069\u306eBMP\u5916\u6587\u5b57\u306f\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u3068\u3057\u30662\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u3092\u5360\u3081\u308b\u305f\u3081\u3001str.length\u304c\u300c\u898b\u305f\u76ee\u306e\u6587\u5b57\u6570\u300d\u3088\u308a\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002\u89e3\u6c7a\u7b56\u306fArray.from(str).length\u307e\u305f\u306f[...str].length\u3092\u4f7f\u3046\u3053\u3068\u3067\u3059\u3002\u3053\u308c\u3089\u306fUnicode\u5bfe\u5fdc\u3067\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u30921\u6587\u5b57\u3068\u3057\u3066\u6271\u3044\u307e\u3059\u3002\u3055\u3089\u306b\u6b63\u78ba\u306b\u3057\u305f\u3044\u5834\u5408\uff08\u56fd\u65d7\u30fb\u5bb6\u65cf\u7d75\u6587\u5b57\u306a\u3069\u306e\u8907\u5408\u6587\u5b57\u3092\u542b\u3080\u5834\u5408\uff09\u306fIntl.Segmenter\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Q. JavaScript\u3067\u914d\u5217\u304c\u7a7a\u304b\u3069\u3046\u304b\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u304b\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A. arr.length === 0\u3067\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002\u7a7a\u914d\u5217\uff08[]\uff09\u306elength\u306f0\u3092\u8fd4\u3057\u307e\u3059\u3002if (arr.length === 0) { console.log(\"\u7a7a\u914d\u5217\"); }\u306e\u3088\u3046\u306b\u66f8\u304d\u307e\u3059\u3002\u307e\u305f\u306f!arr.length\u3067\u3082Falsy\u5224\u5b9a\uff08length=0\u306fFalsy\uff09\u3067\u304d\u307e\u3059\u304c\u3001\u610f\u56f3\u3092\u660e\u78ba\u306b\u3059\u308b\u305f\u3081length === 0\u306e\u6bd4\u8f03\u304c\u63a8\u5968\u3067\u3059\u3002null\/undefined\u306e\u53ef\u80fd\u6027\u304c\u3042\u308b\u5834\u5408\u306fif (!arr || arr.length === 0)\u3068guard\u3092\u4ed8\u3051\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Q. JavaScript\u3067\u914d\u5217\u3092\u7a7a\u306b\u3059\u308b\u4e00\u756a\u826f\u3044\u65b9\u6cd5\u306f\u4f55\u3067\u3059\u304b\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A. 3\u3064\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002\u2460arr.length = 0\uff08\u6700\u3082\u4e00\u822c\u7684\uff09: \u540c\u3058\u914d\u5217\u306e\u53c2\u7167\u3092\u7dad\u6301\u3057\u305f\u307e\u307e\u5168\u8981\u7d20\u3092\u524a\u9664\u3002\u4ed6\u306e\u5909\u6570\u304c\u540c\u3058\u914d\u5217\u3092\u53c2\u7167\u3057\u3066\u3044\u3066\u3082\u7a7a\u306b\u306a\u308b\u3002\u2461arr = []: \u65b0\u3057\u3044\u7a7a\u914d\u5217\u3092\u4ee3\u5165\u3002\u4ed6\u306e\u5909\u6570\u304carr\u53c2\u7167\u3057\u3066\u3044\u305f\u5834\u5408\u306f\u5f71\u97ff\u3057\u306a\u3044\u3002\u2462arr.splice(0): \u5168\u8981\u7d20\u3092\u524a\u9664\u3057\u5143\u306e\u53c2\u7167\u3092\u7dad\u6301\u3002\u524a\u9664\u3057\u305f\u8981\u7d20\u306e\u914d\u5217\u3092\u8fd4\u3059\u3002\u901a\u5e38\u306farr.length = 0\u304c\u6700\u3082\u30b7\u30f3\u30d7\u30eb\u3067\u9ad8\u901f\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Q. \u6587\u5b57\u5217\u306elength\u3067\u672b\u5c3e\u306e\u6587\u5b57\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u304b\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A. str[str.length - 1]\u3067\u6700\u5f8c\u306e\u6587\u5b57\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002\u4f8b: \"hello\"[5-1] \u2192 \"hello\"[4] \u2192 \"o\"\u3002ES2022\u4ee5\u964d\u3067\u306fstr.at(-1)\u3068\u3044\u3046\u3088\u308a\u7c21\u6f54\u306a\u65b9\u6cd5\u3082\u4f7f\u3048\u307e\u3059\uff08\u8ca0\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u672b\u5c3e\u304b\u3089\u6570\u3048\u308b\uff09\u3002\u914d\u5217\u3082\u540c\u69d8\u3067arr[arr.length - 1]\u307e\u305f\u306farr.at(-1)\u3067\u672b\u5c3e\u8981\u7d20\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Q. Claude Code\u306bJavaScript\u306elength\u306b\u95a2\u3059\u308b\u30b3\u30fc\u30c9\u3092\u4f5c\u3063\u3066\u3082\u3089\u3046\u306b\u306f\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A. \u300c\u76ee\u7684\u300d\u3068\u300c\u7d75\u6587\u5b57\u30fbUnicode\u5bfe\u5fdc\u304c\u5fc5\u8981\u304b\u3069\u3046\u304b\u300d\u3092\u4f1d\u3048\u308b\u306e\u304c\u52b9\u679c\u7684\u3067\u3059\u3002\u4f8b: \u300cJavaScript\u3067\u30c6\u30ad\u30b9\u30c8\u30a8\u30ea\u30a2\u306e\u5165\u529b\u6587\u5b57\u6570\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u6570\u3048\u3066\u6b8b\u308a\u6587\u5b57\u6570\u3092\u8868\u793a\u3059\u308b\u30b3\u30fc\u30c9\u3002\u6700\u5927140\u6587\u5b57\u3002\u7d75\u6587\u5b57\u30821\u6587\u5b57\u3068\u3057\u3066\u30ab\u30a6\u30f3\u30c8\u3057\u3066\u307b\u3057\u3044\u3002\u300d\u3068\u4f1d\u3048\u308b\u3068\u3001Array.from\u3092\u4f7f\u3063\u305fUnicode\u5bfe\u5fdc\u306e\u30b3\u30fc\u30c9\u304c\u8fd4\u3063\u3066\u304d\u307e\u3059\u3002\u300c\u7d75\u6587\u5b57\u5bfe\u5fdc\u304c\u5fc5\u8981\u300d\u3068\u3044\u3046\u4e00\u8a00\u304c\u91cd\u8981\u3067\u3001\u3053\u308c\u306a\u3057\u3060\u3068str.length\u3092\u4f7f\u3063\u305f\u30b3\u30fc\u30c9\u304c\u8fd4\u3063\u3066\u304f\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<script type=\"application\/ld+json\">\n{\n  \"@context\": \"https:\/\/schema.org\",\n  \"@type\": \"FAQPage\",\n  \"mainEntity\": [\n    {\n      \"@type\": \"Question\",\n      \"name\": \"JavaScript\u3067length\u306f\u3069\u3046\u3084\u3063\u3066\u4f7f\u3044\u307e\u3059\u304b\uff1f\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"length\u306fJavaScript\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\uff08\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u306a\u3044\uff09\u306a\u306e\u3067\u3001\u62ec\u5f27\u306a\u3057\u3067\u4f7f\u3044\u307e\u3059\u3002\u6587\u5b57\u5217\u306a\u3089 str.length\u3001\u914d\u5217\u306a\u3089 arr.length \u3068\u66f8\u304d\u307e\u3059\u3002str.length()\u306e\u3088\u3046\u306b\u62ec\u5f27\u3092\u4ed8\u3051\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u6587\u5b57\u5217\u3067\u306f\u6587\u5b57\u6570\uff08UTF-16\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u6570\uff09\u3001\u914d\u5217\u3067\u306f\u8981\u7d20\u6570\u304c\u8fd4\u308a\u307e\u3059\u3002\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"JavaScript\u3067\u6587\u5b57\u5217\u306e\u6587\u5b57\u6570\u3092\u6b63\u78ba\u306b\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u3044\u3002length\u3067\u306f\u7d75\u6587\u5b57\u304c2\u306b\u306a\u308a\u307e\u3059\u3002\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"JavaScript\u306e\u6587\u5b57\u5217\u306fUTF-16\u3067\u7ba1\u7406\u3055\u308c\u3066\u304a\u308a\u3001\u7d75\u6587\u5b57\u306a\u3069\u306eBMP\u5916\u6587\u5b57\u306f\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u3068\u3057\u30662\u30b3\u30fc\u30c9\u30e6\u30cb\u30c3\u30c8\u3092\u5360\u3081\u308b\u305f\u3081\u3001str.length\u304c\u300c\u898b\u305f\u76ee\u306e\u6587\u5b57\u6570\u300d\u3088\u308a\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002\u89e3\u6c7a\u7b56\u306fArray.from(str).length\u307e\u305f\u306f[...str].length\u3092\u4f7f\u3046\u3053\u3068\u3067\u3059\u3002\u3053\u308c\u3089\u306fUnicode\u5bfe\u5fdc\u3067\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u30921\u6587\u5b57\u3068\u3057\u3066\u6271\u3044\u307e\u3059\u3002\u3055\u3089\u306b\u6b63\u78ba\u306b\u3057\u305f\u3044\u5834\u5408\uff08\u56fd\u65d7\u30fb\u5bb6\u65cf\u7d75\u6587\u5b57\u306a\u3069\u306e\u8907\u5408\u6587\u5b57\u3092\u542b\u3080\u5834\u5408\uff09\u306fIntl.Segmenter\u3092\u4f7f\u3044\u307e\u3059\u3002\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"JavaScript\u3067\u914d\u5217\u304c\u7a7a\u304b\u3069\u3046\u304b\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u304b\uff1f\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"arr.length === 0\u3067\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002\u7a7a\u914d\u5217\uff08[]\uff09\u306elength\u306f0\u3092\u8fd4\u3057\u307e\u3059\u3002if (arr.length === 0) { console.log(\\\"\u7a7a\u914d\u5217\\\"); }\u306e\u3088\u3046\u306b\u66f8\u304d\u307e\u3059\u3002\u307e\u305f\u306f!arr.length\u3067\u3082Falsy\u5224\u5b9a\uff08length=0\u306fFalsy\uff09\u3067\u304d\u307e\u3059\u304c\u3001\u610f\u56f3\u3092\u660e\u78ba\u306b\u3059\u308b\u305f\u3081length === 0\u306e\u6bd4\u8f03\u304c\u63a8\u5968\u3067\u3059\u3002null\/undefined\u306e\u53ef\u80fd\u6027\u304c\u3042\u308b\u5834\u5408\u306fif (!arr || arr.length === 0)\u3068guard\u3092\u4ed8\u3051\u307e\u3059\u3002\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"JavaScript\u3067\u914d\u5217\u3092\u7a7a\u306b\u3059\u308b\u4e00\u756a\u826f\u3044\u65b9\u6cd5\u306f\u4f55\u3067\u3059\u304b\uff1f\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"3\u3064\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002\u2460arr.length = 0\uff08\u6700\u3082\u4e00\u822c\u7684\uff09: \u540c\u3058\u914d\u5217\u306e\u53c2\u7167\u3092\u7dad\u6301\u3057\u305f\u307e\u307e\u5168\u8981\u7d20\u3092\u524a\u9664\u3002\u4ed6\u306e\u5909\u6570\u304c\u540c\u3058\u914d\u5217\u3092\u53c2\u7167\u3057\u3066\u3044\u3066\u3082\u7a7a\u306b\u306a\u308b\u3002\u2461arr = []: \u65b0\u3057\u3044\u7a7a\u914d\u5217\u3092\u4ee3\u5165\u3002\u4ed6\u306e\u5909\u6570\u304carr\u53c2\u7167\u3057\u3066\u3044\u305f\u5834\u5408\u306f\u5f71\u97ff\u3057\u306a\u3044\u3002\u2462arr.splice(0): \u5168\u8981\u7d20\u3092\u524a\u9664\u3057\u5143\u306e\u53c2\u7167\u3092\u7dad\u6301\u3002\u524a\u9664\u3057\u305f\u8981\u7d20\u306e\u914d\u5217\u3092\u8fd4\u3059\u3002\u901a\u5e38\u306farr.length = 0\u304c\u6700\u3082\u30b7\u30f3\u30d7\u30eb\u3067\u9ad8\u901f\u3067\u3059\u3002\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u6587\u5b57\u5217\u306elength\u3067\u672b\u5c3e\u306e\u6587\u5b57\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u304b\uff1f\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"str[str.length - 1]\u3067\u6700\u5f8c\u306e\u6587\u5b57\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002\u4f8b: \\\"hello\\\"[5-1] \u2192 \\\"hello\\\"[4] \u2192 \\\"o\\\"\u3002ES2022\u4ee5\u964d\u3067\u306fstr.at(-1)\u3068\u3044\u3046\u3088\u308a\u7c21\u6f54\u306a\u65b9\u6cd5\u3082\u4f7f\u3048\u307e\u3059\uff08\u8ca0\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u672b\u5c3e\u304b\u3089\u6570\u3048\u308b\uff09\u3002\u914d\u5217\u3082\u540c\u69d8\u3067arr[arr.length - 1]\u307e\u305f\u306farr.at(-1)\u3067\u672b\u5c3e\u8981\u7d20\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"Claude Code\u306bJavaScript\u306elength\u306b\u95a2\u3059\u308b\u30b3\u30fc\u30c9\u3092\u4f5c\u3063\u3066\u3082\u3089\u3046\u306b\u306f\uff1f\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"\u300c\u76ee\u7684\u300d\u3068\u300c\u7d75\u6587\u5b57\u30fbUnicode\u5bfe\u5fdc\u304c\u5fc5\u8981\u304b\u3069\u3046\u304b\u300d\u3092\u4f1d\u3048\u308b\u306e\u304c\u52b9\u679c\u7684\u3067\u3059\u3002\u4f8b: \u300cJavaScript\u3067\u30c6\u30ad\u30b9\u30c8\u30a8\u30ea\u30a2\u306e\u5165\u529b\u6587\u5b57\u6570\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u6570\u3048\u3066\u6b8b\u308a\u6587\u5b57\u6570\u3092\u8868\u793a\u3059\u308b\u30b3\u30fc\u30c9\u3002\u6700\u5927140\u6587\u5b57\u3002\u7d75\u6587\u5b57\u30821\u6587\u5b57\u3068\u3057\u3066\u30ab\u30a6\u30f3\u30c8\u3057\u3066\u307b\u3057\u3044\u3002\u300d\u3068\u4f1d\u3048\u308b\u3068\u3001Array.from\u3092\u4f7f\u3063\u305fUnicode\u5bfe\u5fdc\u306e\u30b3\u30fc\u30c9\u304c\u8fd4\u3063\u3066\u304d\u307e\u3059\u3002\u300c\u7d75\u6587\u5b57\u5bfe\u5fdc\u304c\u5fc5\u8981\u300d\u3068\u3044\u3046\u4e00\u8a00\u304c\u91cd\u8981\u3067\u3001\u3053\u308c\u306a\u3057\u3060\u3068str.length\u3092\u4f7f\u3063\u305f\u30b3\u30fc\u30c9\u304c\u8fd4\u3063\u3066\u304f\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\"\n      }\n    }\n  ]\n}\n<\/script>\n\n\n","protected":false},"excerpt":{"rendered":"<p>JavaScript\u306elength\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5b8c\u5168\u89e3\u8aac\u3002\u6587\u5b57\u5217\u306e\u6587\u5b57\u6570\u53d6\u5f97\u3001\u914d\u5217\u306e\u8981\u7d20\u6570\u3001\u7d75\u6587\u5b57\u30fb\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u3092\u542b\u3080\u5834\u5408\u306e\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\u306e\u7f60\u3001Array.from()\u306b\u3088\u308b\u6b63\u78ba\u306a\u6587\u5b57\u6570\u8a08\u7b97\u3001\u95a2\u6570\u306elength\u3001Claude Code\u3067\u306e\u6d3b\u7528\u307e\u3067\u5b9f\u4f8b\u30b3\u30fc\u30c9\u4ed8\u304d\u3067\u7db2\u7f85\u3002<\/p>\n","protected":false},"author":1,"featured_media":18456,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sitemap_hide":"","_veu_custom_css":"","vkexunit_cta_each_option":"","footnotes":"","rank_math_description":"JavaScript\u306elength\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5b8c\u5168\u89e3\u8aac\u3002\u6587\u5b57\u5217\u306e\u6587\u5b57\u6570\u53d6\u5f97\u3001\u914d\u5217\u306e\u8981\u7d20\u6570\u3001\u7d75\u6587\u5b57\u30fb\u30b5\u30ed\u30b2\u30fc\u30c8\u30da\u30a2\u3092\u542b\u3080\u5834\u5408\u306e\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\u306e\u7f60\u3001Array.from()\u306b\u3088\u308b\u6b63\u78ba\u306a\u6587\u5b57\u6570\u8a08\u7b97\u3001\u95a2\u6570\u306elength\u3001Claude Code\u3067\u306e\u6d3b\u7528\u307e\u3067\u5b9f\u4f8b\u30b3\u30fc\u30c9\u4ed8\u304d\u3067\u7db2\u7f85\u3002","rank_math_focus_keyword":"JavaScript length \u6587\u5b57\u5217 \u914d\u5217 \u9577\u3055","rank_math_title":"\u30102026\u5e747\u6708\u6700\u65b0\u3011JavaScript length\u3067\u6587\u5b57\u5217\u30fb\u914d\u5217\u306e\u9577\u3055\u3092\u53d6\u5f97\u3059\u308b\u5b8c\u5168\u30ac\u30a4\u30c9\uff5c\u7d75\u6587\u5b57\u30fbUnicode\uff5cAI\u9b3c\u7ba1\u7406","pending_rewrite_html":"","pending_rewrite_id":"","pending_rewrite_kw":"","pending_rewrite_at":"","pending_rewrite_source":"","pending_rewrite_brief":"","pending_rewrite_evidence":"","approved_rewrite_html":"","approved_rewrite_id":"","approved_rewrite_kw":"","approved_rewrite_at":"","approved_rewrite_by":"","approved_rewrite_brief":"","approved_rewrite_evidence":"","rewrite_tracker_baseline":"","rewrite_tracker_7day":"","rewrite_tracker_14day":"","rewrite_tracker_30day":"","rewrite_tracker_notified":""},"categories":[3,2],"tags":[],"class_list":["post-18457","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-automation","category-claude-tips"],"_links":{"self":[{"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/posts\/18457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/comments?post=18457"}],"version-history":[{"count":2,"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/posts\/18457\/revisions"}],"predecessor-version":[{"id":18459,"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/posts\/18457\/revisions\/18459"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/media\/18456"}],"wp:attachment":[{"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/media?parent=18457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/categories?post=18457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/genai-ai.co.jp\/ai-kanri\/wp-json\/wp\/v2\/tags?post=18457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}