{"id":1247,"date":"2025-04-02T14:09:58","date_gmt":"2025-04-02T05:09:58","guid":{"rendered":"https:\/\/route-zero.com\/recruit\/route\/1247\/"},"modified":"2025-05-27T14:19:06","modified_gmt":"2025-05-27T05:19:06","slug":"1247","status":"publish","type":"route","link":"https:\/\/route-zero.com\/recruit\/route\/1247\/","title":{"rendered":"\u3010\u521d\u5fc3\u8005\u5fc5\u898b\u3011JavaScript\u3067\u30b3\u30fc\u30c9\u304c\u66f8\u3051\u306a\u3044\u672c\u5f53\u306e\u7406\u7531\u3068\u201c\u9806\u5e8f\u8a2d\u8a08\u201d\u306e\u3059\u3059\u3081"},"content":{"rendered":"<div>\n<h3>\u306f\u3058\u3081\u306b\uff5c\u3053\u306e\u8a18\u4e8b\u3067\u89e3\u6c7a\u3067\u304d\u308b\u3053\u3068<\/h3>\n<p>\u300cJavaScript\u3092\u52c9\u5f37\u3057\u3066\u3044\u308b\u306e\u306b\u3001\u306a\u304b\u306a\u304b\u30b3\u30fc\u30c9\u304c\u66f8\u3051\u306a\u3044\u300d\u305d\u3093\u306a\u58c1\u306b\u3076\u3064\u304b\u3063\u3066\u3044\u307e\u305b\u3093\u304b\uff1f<\/p>\n<p>\u5b9f\u306f\u305d\u306e\u539f\u56e0\u3001\u591a\u304f\u306e\u5834\u5408\u306f\u6587\u6cd5\u77e5\u8b58\u3067\u306f\u306a\u304f\u3001<strong>\u51e6\u7406\u306e\u9806\u5e8f\uff08\u30ed\u30b8\u30c3\u30af\uff09\u3092\u8a2d\u8a08\u3067\u304d\u3066\u3044\u306a\u3044<\/strong>\u3053\u3068\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001\u300c\u9806\u5e8f\u8a2d\u8a08\uff08\u30ed\u30b8\u30c3\u30af\u8a2d\u8a08\uff09\u300d\u3068\u3044\u3046\u8996\u70b9\u304b\u3089\u4ee5\u4e0b\u306e\u7591\u554f\u3092\u30af\u30ea\u30a2\u306b\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>\n<p>\u306a\u305c\u30b3\u30fc\u30c9\u304c\u66f8\u304d\u51fa\u305b\u306a\u3044\u306e\u304b\uff1f<\/p>\n<\/li>\n<li>\n<p>\u8a2d\u8a08\u3068\u5b9f\u88c5\u306e\u201c\u9593\u201d\u306b\u3042\u308b\u843d\u3068\u3057\u7a74\u3068\u306f\uff1f<\/p>\n<\/li>\n<li>\n<p>\u66f8\u3051\u308b\u4eba\u304c\u7fd2\u6163\u306b\u3057\u3066\u3044\u308b\u8a2d\u8a08\u30b9\u30c6\u30c3\u30d7\u3068\u306f\uff1f<\/p>\n<\/li>\n<\/ul>\n<hr>\n<h2>\u30ed\u30b8\u30c3\u30af\u8a2d\u8a08\u306e\u57fa\u672c\uff5c\u201c\u51fa\u529b\u201d\u304b\u3089\u9006\u7b97\u305b\u3088<\/h2>\n<h3>\u30b4\u30fc\u30eb\u304c\u898b\u3048\u308b\u3068\u3001\u624b\u304c\u52d5\u304f<\/h3>\n<p>\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u7b2c\u4e00\u6b69\u306f\u3001\u300c\u3053\u306e\u51e6\u7406\u3067\u4f55\u3092\u51fa\u529b\u3057\u305f\u3044\u306e\u304b\uff1f\u300d\u3068\u3044\u3046\u30b4\u30fc\u30eb\u8a2d\u5b9a\u3067\u3059\u3002<\/p>\n<pre><code>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2510     \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510     \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\n\u2502  \u5165\u529b  \u2502 \u2192\u2192 \u2502  \u51e6\u7406\uff08\u30ed\u30b8\u30c3\u30af\uff09 \u2502 \u2192\u2192 \u2502  \u51fa\u529b  \u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518     \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518     \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n<\/code><\/pre>\n<p>\u25c6 \u4f8b\uff1a\u6c0f\u540d\u3092\u8868\u793a\u3059\u308b\u51e6\u7406<\/p>\n<pre><code><span>const<\/span> user = { <span>firstName<\/span>: <span>'Taro'<\/span>, <span>lastName<\/span>: <span>'Yamada'<\/span> };\r\n<span>\/\/ \u51fa\u529b \u2192 'Yamada Taro'<\/span>\r\n<\/code><\/pre>\n<p>\u300c\u51fa\u529b\u300d\u304c\u898b\u3048\u3066\u3044\u308c\u3070\u3001\u5fc5\u8981\u306a\u51e6\u7406\u30b9\u30c6\u30c3\u30d7\u304c\u81ea\u7136\u3068\u660e\u78ba\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<hr>\n<h2>4\u30b9\u30c6\u30c3\u30d7\u3067\u30ed\u30b8\u30c3\u30af\u3092\u69cb\u9020\u5316\u3057\u3088\u3046<\/h2>\n<p>\u4ee5\u4e0b\u306e\u30b9\u30c6\u30c3\u30d7\u306b\u5206\u89e3\u3059\u308b\u3053\u3068\u3067\u3001\u5b9f\u88c5\u524d\u306b\u51e6\u7406\u306e\u6d41\u308c\u3092\u6574\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>1. \u5165\u529b\u3092\u53d7\u3051\u53d6\u308b\r\n2. \u30c7\u30fc\u30bf\u3092\u6574\u5f62\u30fb\u52a0\u5de5\u3059\u308b\r\n3. \u6761\u4ef6\u5206\u5c90\u3084\u6f14\u7b97\u3092\u884c\u3046\r\n4. \u51fa\u529b\u3092\u8fd4\u3059<\/code><\/pre>\n<h3>\u6574\u5f62\u51e6\u7406\u306e\u4f8b<\/h3>\n<pre><code><span><span>function<\/span> <span>formatUserName<\/span>(<span>user<\/span>) <\/span>{\r\n  <span>const<\/span> { firstName, lastName } = user;\r\n  <span>return<\/span> <span>`<span>${lastName}<\/span> <span>${firstName}<\/span>`<\/span>;\r\n}<\/code><\/pre>\n<h3>\u6761\u4ef6\u5206\u5c90\u306e\u4f8b\uff08\u30ed\u30b0\u30a4\u30f3\u72b6\u614b\u306e\u78ba\u8a8d\uff09<\/h3>\n<pre><code><span><span>function<\/span> <span>canDownload<\/span>(<span>user<\/span>) <\/span>{\r\n  <span>if<\/span> (!user?.isLoggedIn) <span>return<\/span> <span>false<\/span>;\r\n  <span>if<\/span> (user.role !== <span>'admin'<\/span>) <span>return<\/span> <span>false<\/span>;\r\n  <span>return<\/span> <span>true<\/span>;\r\n}<\/code><\/pre>\n<h3>\u30eb\u30fc\u30d7\u51e6\u7406\u306e\u4f8b\uff08\u30e6\u30fc\u30b6\u30fc\u4e00\u89a7\u306e\u8868\u793a\uff09<\/h3>\n<pre><code><span><span>function<\/span> <span>listUserNames<\/span>(<span>users<\/span>) <\/span>{\r\n  <span>return<\/span> users.map(<span><span>u<\/span> =&gt;<\/span> <span>`<span>${u.lastName}<\/span> <span>${u.firstName}<\/span>`<\/span>);\r\n}<\/code><\/pre>\n<hr>\n<h2>\u3088\u304f\u3042\u308b\u5931\u6557\u4f8b\uff5c\u300c\u4e2d\u9593\u51e6\u7406\u300d\u304b\u3089\u66f8\u304d\u59cb\u3081\u308b<\/h2>\n<h3>&#x274c; NG\u30b3\u30fc\u30c9\uff08\u9806\u5e8f\u8a2d\u8a08\u304c\u306a\u3044\u4f8b\uff09<\/h3>\n<pre><code><span><span>function<\/span> <span>buildUrl<\/span>(<span>user<\/span>) <\/span>{\r\n  <span>const<\/span> fullName = <span>`<span>${user.lastName}<\/span> <span>${user.firstName}<\/span>`<\/span>;\r\n  <span>if<\/span> (!user) <span>return<\/span> <span>''<\/span>;\r\n  <span>return<\/span> <span>`https:\/\/example.com\/<span>${fullName}<\/span>`<\/span>;\r\n}<\/code><\/pre>\n<p>\u2192 null\u30c1\u30a7\u30c3\u30af\u306a\u3069\u306e\u524d\u63d0\u51e6\u7406\u304c\u5f8c\u56de\u3057\u306b\u306a\u3063\u3066\u3044\u3066\u3001\u30d0\u30b0\u306e\u6e29\u5e8a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>&#x2705; OK\u30b3\u30fc\u30c9\uff08\u9806\u5e8f\u3092\u5b88\u3063\u305f\u4f8b\uff09<\/h3>\n<pre><code><span><span>function<\/span> <span>buildUrl<\/span>(<span>user<\/span>) <\/span>{\r\n  <span>if<\/span> (!user) <span>return<\/span> <span>''<\/span>;\r\n  <span>const<\/span> fullName = <span>`<span>${user.lastName}<\/span> <span>${user.firstName}<\/span>`<\/span>;\r\n  <span>return<\/span> <span>`https:\/\/example.com\/<span>${fullName}<\/span>`<\/span>;\r\n}<\/code><\/pre>\n<hr>\n<h2>\u66f8\u3051\u308b\u4eba\u306e\u7fd2\u6163\uff5c\u201c\u8a2d\u8a08\u30e1\u30e2\u201d\u3092\u66f8\u304d\u51fa\u3059<\/h2>\n<h3>\u5916\u90e8\u5316\u3055\u308c\u305f\u601d\u8003\u306f\u5f37\u3044<\/h3>\n<p>\u8a2d\u8a08\u30e1\u30e2\u3092\u66f8\u304f\u3053\u3068\u3067\u3001\u5b9f\u88c5\u6642\u306e\u8ff7\u3044\u3092\u6700\u5c0f\u9650\u306b\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u25c6\u8a2d\u8a08\u30e1\u30e2\u4f8b<\/p>\n<pre><code>- \u76ee\u7684\uff1a\u30e6\u30fc\u30b6\u30fc\u540d\u3092URL\u306b\u5909\u63db\u3057\u305f\u3044\r\n- \u5165\u529b\u5f62\u5f0f\uff1auser\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\r\n- \u5fc5\u8981\u306a\u51e6\u7406\uff1anull\u30c1\u30a7\u30c3\u30af \u2192 \u6c0f\u540d\u6574\u5f62\r\n- \u51fa\u529b\u5f62\u5f0f\uff1ahttps:\/\/example.com\/\u6c0f\u540d<\/code><\/pre>\n<h3>\u6c4e\u7528\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/h3>\n<pre><code>- \u76ee\u7684\uff1a\r\n- \u5165\u529b\u5f62\u5f0f\uff1a\r\n- \u5fc5\u8981\u306a\u51e6\u7406\uff1a\r\n- \u51fa\u529b\u5f62\u5f0f\uff1a<\/code><\/pre>\n<hr>\n<h2>\u307e\u3068\u3081\uff5c\u300c\u9806\u5e8f\u300d\u3092\u8a2d\u8a08\u3067\u304d\u308c\u3070\u3001\u5b9f\u88c5\u306f\u898b\u3048\u308b<\/h2>\n<ul>\n<li>\n<p>JavaScript\u521d\u5fc3\u8005\u304c\u3064\u307e\u305a\u304f\u306e\u306f\u3001\u8a2d\u8a08\u9806\u5e8f\u304c\u66d6\u6627\u3060\u304b\u3089<\/p>\n<\/li>\n<li>\n<p>\u51fa\u529b\u304b\u3089\u9006\u7b97\u3057\u30014\u30b9\u30c6\u30c3\u30d7\u3067\u30ed\u30b8\u30c3\u30af\u3092\u69cb\u9020\u5316\u3059\u308b<\/p>\n<\/li>\n<li>\n<p>\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u524d\u306b\u300c\u8a2d\u8a08\u30e1\u30e2\u300d\u3092\u66f8\u304d\u51fa\u3059\u3060\u3051\u3067\u3001\u5727\u5012\u7684\u306b\u624b\u304c\u6b62\u307e\u3089\u306a\u304f\u306a\u308b<\/p>\n<\/li>\n<\/ul>\n<h3>\u25c6 \u6b21\u306e\u30a2\u30af\u30b7\u30e7\u30f3<\/h3>\n<p>\u4eca\u65e5\u304b\u3089\u3001\u51e6\u7406\u306e\u6d41\u308c\u3092\u7d19\u3084\u30a8\u30c7\u30a3\u30bf\u306b\u300c\u66f8\u304d\u51fa\u3059\u300d\u7fd2\u6163\u3092\u59cb\u3081\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<hr>\n<h3>\u3010\u5916\u90e8\u30ea\u30f3\u30af\u3011<\/h3>\n<p><a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/JavaScript\/Reference\/Operators\/Destructuring_assignment\" target=\"_blank\" rel=\"noopener\">MDN Web Docs: Destructuring assignment<\/a><br \/>\n<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/JavaScript\/Reference\/Functions\/Arrow_functions\" target=\"_blank\" rel=\"noopener\">MDN Web Docs: Arrow functions<\/a><br \/>\n<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/JavaScript\/Reference\/Operators\/Spread_syntax\" target=\"_blank\" rel=\"noopener\">MDN Web Docs: Spread syntax<\/a><br \/>\n<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/JavaScript\/Reference\/Template_literals\" target=\"_blank\" rel=\"noopener\">MDN Web Docs: Template literals<\/a><br \/>\n<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Array\/map\" target=\"_blank\" rel=\"noopener\">MDN Web Docs: Array.prototype.map()<\/a><br \/>\n<a href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Web\/JavaScript\/Reference\/Statements\/async_function\" target=\"_blank\" rel=\"noopener\">MDN Web Docs: async function<\/a><\/p>\n<h3>\u3010\u5185\u90e8\u30ea\u30f3\u30af\u3011<\/h3>\n<p><a href=\"https:\/\/route-zero.com\/recruit\/route\/1109\/\">JavaScript\u3067\u3088\u304f\u767a\u751f\u3059\u308b\u30a8\u30e9\u30fc\u300cReferenceError\u300d\u300cSyntaxError\u300d\u306a\u3069\u306e\u539f\u56e0\u3068\u5bfe\u7b56\u3092\u5177\u4f53\u4f8b\u4ed8\u304d\u3067\u89e3\u8aac<\/a><br \/>\n<a href=\"https:\/\/route-zero.com\/recruit\/route\/917\/\">JavaScript\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u308f\u304b\u3089\u306a\u3044\uff1f\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u5b9f\u4f8b\u3067\u3084\u3055\u3057\u304f\u89e3\u8aac\uff01<\/a><br \/>\n<a href=\"https:\/\/route-zero.com\/recruit\/route\/965\/\">JavaScript\u306e\u914d\u5217\u30fbJSON\u30fbmap\u30fbMap\uff1a\u30c7\u30fc\u30bf\u64cd\u4f5c\u8853<\/a><br \/>\n<a href=\"https:\/\/route-zero.com\/recruit\/route\/1205\/\">JavaScript\u3067CORS\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u3068\u304d\u306e\u539f\u56e0\u3068\u5bfe\u51e6\u6cd5\u3092\u5fb9\u5e95\u89e3\u8aac<\/a><br \/>\n<a href=\"https:\/\/route-zero.com\/recruit\/route\/1128\/\">JavaScript\u306eAjax\u5b8c\u5168\u5165\u9580\uff5cfetch\u306e\u4f7f\u3044\u65b9\u30fbCORS\u30a8\u30e9\u30fc\u306e\u5bfe\u51e6\u30fb\u975e\u540c\u671f\u901a\u4fe1\u306e\u57fa\u672c\u3092\u89e3\u8aac<\/a>\n<\/div>\n","protected":false},"featured_media":1248,"template":"","_links":{"self":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route\/1247"}],"collection":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route"}],"about":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/types\/route"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media\/1248"}],"wp:attachment":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media?parent=1247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}