{"id":13999,"date":"2021-08-15T20:06:14","date_gmt":"2021-08-15T11:06:14","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=13999"},"modified":"2023-05-27T20:53:13","modified_gmt":"2023-05-27T11:53:13","slug":"%e3%80%90javascript%e3%80%91%e3%80%8cnull%e3%80%8d%e3%81%a8%e3%80%8cundefined%e3%80%8d%e3%81%ae%e4%bd%bf%e3%81%84%e5%88%86%e3%81%91","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=13999","title":{"rendered":"\u3010JavaScript\u3011\u300cnull\u300d\u3068\u300cundefined\u300d\u3001\u300c\u7a7a\u6587\u5b57\u300d\u306e\u4f7f\u3044\u5206\u3051"},"content":{"rendered":"<p>\u4ed6\u306e\u8a00\u8a9e\u306b\u6bd4\u3079\u3066JavaScript\u306f\u300c\u4f55\u3082\u306a\u3044\u300d\u3053\u3068\u306e\u8868\u73fe\u65b9\u6cd5\u304c\u4e8c\u3064(null\u3001undefined)\u3042\u308a\u307e\u3059\u3002\u9055\u3044\u306f\u4f55\u3067\u3069\u306e\u3088\u3046\u306b\u4f7f\u3044\u5206\u3051\u308c\u3070\u826f\u3044\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<h2>\u305d\u3082\u305d\u3082\u3001null\u3001undefined\u3001\u7a7a\u6587\u5b57\u306e\u9055\u3044<\/h2>\n<h3>null<\/h3>\n<ul>\n<li>NULL\u3068\u3044\u3046\u30b7\u30f3\u30dc\u30eb<\/li>\n<li>\u610f\u56f3\u7684\u306b\u5909\u6570\u306bnull\u3092\u4ee3\u5165\u3057\u3066\u5024\u304c\u306a\u3044\u3053\u3068\u3092\u793a\u3059\u3002<\/li>\n<li>\u9006\u306b\u8a00\u3048\u3070\u3001\u30d7\u30ed\u30b0\u30e9\u30de\u304c\u660e\u793a\u7684\u306b\u5165\u308c\u306a\u3051\u308c\u3070\u3053\u306e\u5024\u304c\u5165\u308b\u3053\u3068\u306f\u306a\u3044\u3067\u3059\u3002<\/li>\n<\/ul>\n<h4>\u4f8b<\/h4>\n<pre class=\"lang:default decode:true\">var a = null; \/\/null<\/pre>\n<p>\u5909\u6570\u306bnull\u3092\u4ee3\u5165\u3059\u308b\u3068<span style=\"color: #ff0000;\"><strong>any\u578b<\/strong><\/span>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>null\u306e\u307f\u3092\u8a31\u5bb9\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u5834\u5408\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">let a: null = null;<\/pre>\n<h3>undefined<\/h3>\n<ul>\n<li>\u73fe\u6642\u70b9\u3067\u306f\u5b58\u5728\u3057\u306a\u3044\uff08\u672a\u5b9a\u7fa9\uff09\u3067\u3042\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n<li>\u30d7\u30ed\u30b0\u30e9\u30de\u304c\u660e\u793a\u7684\u306b\u4ee3\u5165\u3057\u306a\u304f\u3066\u3082\u5909\u6570\u3092\u5b9a\u7fa9\u3057\u305f\u3089\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u52dd\u624b\u306b\u305d\u3046\u3044\u3046\u72b6\u614b\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u306a\u306e\u3067\u610f\u56f3\u7684\u306a\u306e\u304b\u305d\u3046\u3058\u3083\u306a\u3044\u304b\u304c\u4f1d\u308f\u308a\u3065\u3089\u3044\u3067\u3059\u3002<\/li>\n<\/ul>\n<h4>\u5909\u6570\u3092\u5ba3\u8a00\u3057\u3066\u5024\u3092\u4ee3\u5165\u3059\u308b\u524d\u306e\u72b6\u614b<\/h4>\n<h5>\u4f8b<\/h5>\n<pre class=\"lang:default decode:true\">var a; \/\/undefined<\/pre>\n<h4>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u914d\u5217\u304b\u3089\u5b58\u5728\u3057\u306a\u3044\u30ad\u30fc\u3092\u547c\u3073\u51fa\u3057\u305f\u6642\u306e\u5024<\/h4>\n<h5>\u4f8b<\/h5>\n<pre class=\"lang:default decode:true \">var obj = {};\r\nobj.a \/\/ undefined<\/pre>\n<h3>\u7a7a\u6587\u5b57(\"\")<\/h3>\n<ul>\n<li>\u7a7a\u767d\u3068\u3044\u3046\u5024\u304c\u5b58\u5728\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u6307\u3059\u3002<\/li>\n<li>string\u578b<\/li>\n<\/ul>\n<h4>\u4f8b<\/h4>\n<pre class=\"lang:default decode:true\">var a = \"\"; \/\/\"\"\r\n<\/pre>\n<h2>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u30b1\u30fc\u30b91(\u521d\u671f\u5024)<\/h2>\n<p>\u7d50\u8ad6\u3068\u3057\u3066\u306f\u3001\u521d\u671f\u5316\u3092undefined\u306b\u3059\u308b\u306e\u306f\u907f\u3051\u3066null\u3067\u521d\u671f\u5316\u3059\u308b\u306e\u304c\u4e00\u822c\u7684\u306b\u306f\u308f\u304b\u308a\u3084\u3059\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h3>null\u3067\u521d\u671f\u5316<\/h3>\n<h4>\u30e1\u30ea\u30c3\u30c8<\/h4>\n<p>\u610f\u5473\u306e\u3042\u308b\u5024\u304c\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u308b\u304b\u3001\u305d\u3046\u3067\u306a\u3044\u304b\u533a\u5225\u3067\u304d\u308b\u3002<\/p>\n<h4>\u30c7\u30e1\u30ea\u30c3\u30c8<\/h4>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u3069\u3092\u5229\u7528\u3059\u308b\u5834\u5408\u306f\u3001null\u306e\u5834\u5408\u3068\u3044\u3046\u3088\u3046\u306b\u5206\u5c90\u51e6\u7406\u3092\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<h3>\u660e\u793a\u7684\u306b\u521d\u671f\u5316\u3057\u306a\u3044\u3002(undefined)<\/h3>\n<h4>\u30e1\u30ea\u30c3\u30c8<\/h4>\n<p>\u610f\u5473\u306e\u3042\u308b\u5024\u304c\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u308b\u304b\u3001\u305d\u3046\u3067\u306a\u3044\u304b\u533a\u5225\u3067\u304d\u308b\u3002(\u30e1\u30ea\u30c3\u30c8\u306fnull\u3067\u521d\u671f\u5316\u3059\u308b\u5834\u5408\u3068\u540c\u3058\uff09<\/p>\n<h4>\u30c7\u30e1\u30ea\u30c3\u30c8<\/h4>\n<ul>\n<li>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u3069\u3092\u5229\u7528\u3059\u308b\u5834\u5408\u306f\u3001null\u306e\u5834\u5408\u3068\u3044\u3046\u3088\u3046\u306b\u5206\u5c90\u51e6\u7406\u3092\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002(null\u3068\u540c\u3058\uff09<\/li>\n<li>\u5024\u304cundefined\u306e\u5834\u5408\u306b\u672c\u5f53\u306b\u5b58\u5728\u3057\u306a\u3044\u30d7\u30ed\u30d1\u30c6\u30a3\u306a\u306e\u304b\u3001\u5024\u304c\u5358\u7d14\u306b\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u3060\u3051\u306a\u306e\u304b\u308f\u304b\u308a\u3065\u3089\u3044\u3002<\/li>\n<\/ul>\n<h3>\u521d\u671f\u5024\u306f\u3001null\u3084undefined\u4ee5\u5916\uff08\u7a7a\u6587\u5b57\u3084\u914d\u5217\u306a\u3089[]\uff09<\/h3>\n<h4>\u30e1\u30ea\u30c3\u30c8<\/h4>\n<ul>\n<li>null\u3084undefined\u306e\u5834\u5408\u306b\u6bd4\u3079\u3066\u5206\u5c90\u304c\u4e0d\u8981\u306b\u306a\u308b\u3002<\/li>\n<\/ul>\n<h4>\u30c7\u30e1\u30ea\u30c3\u30c8<\/h4>\n<ul>\n<li>\u5024\u304c\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u3089\u306a\u306e\u304b\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306a\u306e\u304b\u5224\u5225\u3067\u304d\u306a\u3044\u3002<\/li>\n<li>\u6570\u5024\u578b\u3068\u304b\u65e5\u4ed8\u578b\u3067\u306f\u7a7a\u3063\u307d\u3044\u5024\u3092\u8868\u73fe\u3067\u304d\u306a\u3044\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"\u4ed6\u306e\u8a00\u8a9e\u306b\u6bd4\u3079\u3066JavaScript\u306f\u300c\u4f55\u3082\u306a\u3044\u300d\u3053\u3068\u306e\u8868\u73fe\u65b9\u6cd5\u304c\u4e8c\u3064(null\u3001undefined)\u3042\u308a\u307e\u3059\u3002\u9055\u3044\u306f\u4f55\u3067\u3069\u306e\u3088\u3046\u306b\u4f7f\u3044\u5206\u3051\u308c\u3070\u826f\u3044\u3067\u3057\u3087\u3046\u304b\uff1f \u305d\u3082\u305d\u3082\u3001null\u3001undefined\u3001\u7a7a\u6587\u5b57\u306e\u9055\u3044 nu [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/13999"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13999"}],"version-history":[{"count":8,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/13999\/revisions"}],"predecessor-version":[{"id":20273,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/13999\/revisions\/20273"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13999"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}