{"id":56920,"date":"2018-02-06T09:01:19","date_gmt":"2018-02-06T00:01:19","guid":{"rendered":"http:\/\/www.softantenna.com\/wp\/?p=56920"},"modified":"2018-02-06T09:01:19","modified_gmt":"2018-02-06T00:01:19","slug":"javascript-error-top-10","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/javascript-error-top-10\/","title":{"rendered":"JavaScript\u958b\u767a\u8005\u5fc5\u898b\u306e1000\u4ee5\u4e0a\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304b\u3089\u53ce\u96c6\u3057\u305fJavaScript\u30a8\u30e9\u30fc\u30c8\u30c3\u30d710"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2018\/02\/Ijavascript-error-graph.jpg\" alt=\"Javascript error graph\" title=\"javascript-error-graph.jpg\" border=\"0\" width=\"1116\" height=\"691\" \/><\/p>\n<p>\u73fe\u4ee3\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u6b20\u304b\u3059\u3053\u3068\u306e\u3067\u304d\u306a\u3044\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u300cJavaScript\u300d\u3002GitHub\u3084TIOBE Index\u306a\u3069\u5404\u7a2e\u4eba\u6c17\u30e9\u30f3\u30ad\u30f3\u30b0\u3067\u3082\u5e38\u306b\u4e0a\u4f4d\u306b\u98df\u3044\u8fbc\u307f\u5e83\u304f\u666e\u53ca\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057JavaScript\u306f\u6c17\u8efd\u306b\u4f7f\u7528\u3067\u304d\u308b\u53cd\u9762\u3001\u52d5\u7684\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u7279\u6709\u306e\u30a8\u30e9\u30fc\u3082\u767a\u751f\u3057\u3084\u3059\u304f\u3001JavaScript\u8a00\u8a9e\u306b\u6163\u308c\u3066\u3044\u306a\u3044\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u3001\u30c7\u30d0\u30c3\u30b0\u4f5c\u696d\u306f\u56f0\u96e3\u306a\u3082\u306e\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u53ef\u80fd\u6027\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u30a8\u30e9\u30fc\u53ce\u96c6\u30b5\u30fc\u30d3\u30b9\u306eRollbar\u306f1,000\u4ee5\u4e0a\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304b\u3089\u5831\u544a\u3055\u308c\u305fJavaScript\u306e\u30a8\u30e9\u30fc\u3092\u53ce\u96c6\u3057\u3001<a href=\"https:\/\/rollbar.com\/blog\/top-10-javascript-errors\/\">\u8d77\u3053\u308a\u3084\u3059\u3044JavaScript\u30a8\u30e9\u30fc\u30c8\u30c3\u30d710<\/a>\u3092\u516c\u958b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30a8\u30e9\u30fc\u306e\u7a2e\u985e\u3060\u3051\u3067\u306f\u306a\u304f\u3001\u539f\u56e0\u3084\u89e3\u6c7a\u65b9\u6cd5\u3082\u793a\u3055\u308c\u3066\u3044\u308b\u3001JavaScript\u958b\u767a\u8005\u5fc5\u898b\u306e\u60c5\u5831\u3068\u3044\u3048\u305d\u3046\u3067\u3059\u3002<\/p>\n<h2>1\u4f4d\u306fUncaught TypeError: Cannot read property<\/h2>\n<p>\u540c\u30b5\u30a4\u30c8\u306b\u3088\u308bJavaScript\u30a8\u30e9\u30fc\u306e1\u4f4d\u306f\u300c<span class=\"mybold\">Uncaught TypeError: Cannot read property<\/span>\u300d\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30a8\u30e9\u30fc\u306e\u539f\u56e0\u3068\u3057\u3066\u3055\u307e\u3056\u307e\u306a\u7406\u7531\u304c\u8003\u3048\u3089\u308c\u308b\u305d\u3046\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070UI\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3059\u308b\u969b\u3001\u521d\u671f\u5316\u304c\u6b63\u3057\u304f\u5b9f\u884c\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306b\u767a\u751f\u3059\u308b\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n<pre><code class=\"javascript\">class Quiz extends Component {\n  componentWillMount() {\n    axios.get('\/thedata').then(res =&gt; {\n      this.setState({items: res.data});\n    });\n  }\n\n  render() {\n    return (\n      &lt;ul&gt;\n        {this.state.items.map(item =&gt;\n          &lt;li key={item.id}&gt;{item.name}&lt;\/li&gt;\n        )}\n      &lt;\/ul&gt;\n    );\n  }\n}<\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306f<\/p>\n<ul>\n<li>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306estate\u304cundefined\u3067\u59cb\u307e\u308a<\/li>\n<li>\u30c7\u30fc\u30bf\u304c\u975e\u540c\u671f\u306b\u30d5\u30a7\u30c3\u30c1\u3055\u308c\u308b\u3068\u3001\u30c7\u30fc\u30bf\u304c\u30ed\u30fc\u30c9\u3055\u308c\u308b\u524d\u306b\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u3001\u305d\u306e\u969bthis.state.items\u304cundefined\u3067\u3042\u308b\u305f\u3081\"Uncaught TypeError: Cannot read property \u2018map\u2019 of undefined\"\u304c\u767a\u751f<\/li>\n<\/ul>\n<p>\u3059\u308b\u3068\u306e\u3053\u3068\u3002<\/p>\n<p>\u5e78\u3044\u4fee\u6b63\u306f\u7c21\u5358\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u9069\u5207\u306a\u5024\u306b\u521d\u671f\u5316\u3059\u308c\u3070\u826f\u3044\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<pre><code class=\"javascript\">class Quiz extends Component {\n  \/\/ Added this:\n  constructor(props) {\n    super(props);\n\n    \/\/ Assign state itself, and a default value for items\n    this.state = {\n      items: []\n    };\n  }\n\n  componentWillMount() {\n    axios.get('\/thedata').then(res =&gt; {\n      this.setState({items: res.data});\n    });\n  }\n\n  render() {\n    return (\n      &lt;ul&gt;\n        {this.state.items.map(item =&gt;\n          &lt;li key={item.id}&gt;{item.name}&lt;\/li&gt;\n        )}\n      &lt;\/ul&gt;\n    );\n  }\n}<\/code><\/pre>\n<p>\u540c\u30b5\u30a4\u30c8\u3067\u306f\u3053\u308c\u4ee5\u5916\u306b\u3082\u5408\u8a0810\u500b\u306e\u30a8\u30e9\u30fc\u306b\u3064\u3044\u3066\u8a73\u3057\u3044\u89e3\u8aac\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002JavaScript\u958b\u767a\u6642\u306e\u30a8\u30e9\u30fc\u306b\u60a9\u307e\u3055\u308c\u3066\u3044\u308b\u65b9\u306f\u53c2\u7167\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73fe\u4ee3\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u6b20\u304b\u3059\u3053\u3068\u306e\u3067\u304d\u306a\u3044\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u300cJavaScript\u300d\u3002GitHub\u3084TIOBE Index\u306a\u3069\u5404\u7a2e\u4eba\u6c17\u30e9\u30f3\u30ad\u30f3\u30b0\u3067\u3082\u5e38\u306b\u4e0a\u4f4d\u306b\u98df\u3044\u8fbc\u307f\u5e83\u304f\u666e\u53ca\u3057\u3066\u3044\u307e\u3059\u3002 \u3057\u304b\u3057JavaScr [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":56964,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[66],"tags":[655],"class_list":["post-56920","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webservice","tag-javascript"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/56920","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=56920"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/56920\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/56964"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=56920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=56920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=56920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}