{"id":4327,"date":"2018-05-17T20:10:15","date_gmt":"2018-05-17T18:10:15","guid":{"rendered":"https:\/\/monodes.com\/predaelli\/?p=4327"},"modified":"2018-05-17T11:10:28","modified_gmt":"2018-05-17T09:10:28","slug":"top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2018\/05\/17\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them\/","title":{"rendered":"Top 10 JavaScript errors from 1000+ projects (and how to avoid them)"},"content":{"rendered":"<p>From <em><a href=\"https:\/\/codeburst.io\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them-2956ce008437\">Top 10 JavaScript errors from 1000+ projects (and how to avoid them)<\/a><\/em><\/p>\n<p><a href=\"https:\/\/codeburst.io\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them-2956ce008437\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/0%2AxAkAyZF4yy-k8kbz.png?w=910&#038;ssl=1\" alt=\"\" \/><\/a><\/p>\n<p>Most of them are caught at compile time by strongly-typed languages. Who said Eiffel?<\/p>\n<p>Oh, how I want not to be so busy with other issues&#8230;. \ud83d\ude41<\/p>\n<p><!--more--><!--nextpage--><\/p>\n<blockquote>\n<p id=\"9a90\" class=\"graf graf--p graf-after--figure\">To give back to our community of developers, we looked at our database of thousands of projects and found the top 10 errors in JavaScript. We\u2019re going to show you what causes them and how to prevent them from happening. If you avoid these \u201cgotchas,\u201d it\u2019ll make you a better developer.<\/p>\n<p id=\"706f\" class=\"graf graf--p graf-after--p\">Because data is king, we collected, analyzed, and ranked the top 10 <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.paved.com\/redirect\/28zqzyg8q9vt7yg5ye91n3o3u8j\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.paved.com\/redirect\/28zqzyg8q9vt7yg5ye91n3o3u8j\"><strong class=\"markup--strong markup--p-strong\">JavaScript errors<\/strong><\/a>. Rollbar collects all the errors for each project and summarizes how many times each one occurred. We do this by grouping errors according to their <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.paved.com\/redirect\/jkl1h8do8ro1gj0stglsn2honit\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.paved.com\/redirect\/jkl1h8do8ro1gj0stglsn2honit\"><strong class=\"markup--strong markup--p-strong\">fingerprints<\/strong><\/a>. Basically, we group two errors if the second one is just a repeat of the first. This gives users a nice overview instead of an overwhelming big dump like you\u2019d see in a log file.<\/p>\n<p id=\"7741\" class=\"graf graf--p graf-after--p\">We focused on the errors most likely to affect you and your users. To do this, we ranked errors by the number of projects experiencing them across different companies. If we looked only at the total number of times each error occurred, then high-volume customers could overwhelm the data set with errors that are not relevant to most readers.<\/p>\n<h4 id=\"a001\" class=\"graf graf--h4 graf-after--p\"><strong class=\"markup--strong markup--h4-strong\">Here are the top 10 JavaScript errors<\/strong>:<\/h4>\n<figure id=\"d1fe\" class=\"graf graf--figure graf-after--h4\">\n<div class=\"aspectRatioPlaceholder is-locked\"><\/div>\n<\/figure>\n<section class=\"section section--body section--first\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure id=\"d1fe\" class=\"graf graf--figure graf-after--h4\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*xAkAyZF4yy-k8kbz.png\" data-width=\"864\" data-height=\"535\" data-action=\"zoom\" data-action-value=\"0*xAkAyZF4yy-k8kbz.png\" data-scroll=\"native\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/0%2AxAkAyZF4yy-k8kbz.png?w=910&#038;ssl=1\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*xAkAyZF4yy-k8kbz.png\" \/><\/div>\n<\/div>\n<\/figure>\n<p id=\"89e4\" class=\"graf graf--p graf-after--figure graf--trailing\"><strong class=\"markup--strong markup--p-strong\">Each error has been shortened for easier readability. Let\u2019s dive deeper into each one to determine what can cause it and how you can avoid creating it.<\/strong><\/p>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"22a2\" class=\"graf graf--h4 graf--leading\">1. Uncaught TypeError: Cannot read\u00a0property<\/h4>\n<p id=\"36da\" class=\"graf graf--p graf-after--h4\">If you\u2019re a JavaScript developer, you\u2019ve probably seen this error more than you care to admit. This one occurs in Chrome when you read a property or call a method on an undefined object. You can test this very easily in the Chrome Developer Console.<\/p>\n<figure id=\"0685\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\"><\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure id=\"0685\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*9skV74NtZolgNSNc.png\" data-width=\"864\" data-height=\"137\" data-action=\"zoom\" data-action-value=\"0*9skV74NtZolgNSNc.png\" data-scroll=\"native\"><a href=\"https:\/\/codeburst.io\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them-2956ce008437\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/0%2ADvKP95jvk8HBWdXH.png?w=910&#038;ssl=1\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<\/figure>\n<p id=\"5dfb\" class=\"graf graf--p graf-after--figure\">This can occur for many reasons, but a common one is improper initialization of state while rendering the UI components. Let\u2019s look at an example of how this can occur in a real-world app. We\u2019ll pick React, but the same principles of improper initialization also apply to Angular, Vue or any other framework.<\/p>\n<pre id=\"2a4f\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">class Quiz extends Component {\n  componentWillMount() {\n    axios.get(&#039;\/thedata&#039;).then(res =&gt; {\n      this.setState({items: res.data});\n    });\n  }<\/code><\/pre>\n<pre id=\"0cd5\" class=\"graf graf--pre graf-after--pre\"><code class=\"\" data-line=\"\">  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 id=\"2f7e\" class=\"graf graf--p graf-after--pre\">There are two important things realize here:<\/p>\n<ol class=\"postList\">\n<li id=\"759a\" class=\"graf graf--li graf-after--p\">A component\u2019s state (e.g. <code class=\"\" data-line=\"\">this.state<\/code>) begins life as <code class=\"\" data-line=\"\">undefined<\/code>.<\/li>\n<li id=\"aaa0\" class=\"graf graf--li graf-after--li\">When you fetch data asynchronously, the component will render at least once before the data is loaded\u200a\u2014\u200aregardless of whether it\u2019s fetched in the constructor, <code class=\"\" data-line=\"\">componentWillMount<\/code> or <code class=\"\" data-line=\"\">componentDidMount<\/code>. When Quiz first renders, <code class=\"\" data-line=\"\">this.state.items<\/code> is undefined. This, in turn, means <code class=\"\" data-line=\"\">ItemList<\/code> gets items as undefined, and <em class=\"markup--em markup--li-em\">you<\/em> get an error \u2013 &#8220;Uncaught TypeError: Cannot read property \u2018map\u2019 of undefined&#8221; in the console.<\/li>\n<\/ol>\n<p id=\"7275\" class=\"graf graf--p graf-after--li\">This is easy to fix. The simplest way: Initialize state with reasonable default values in the constructor.<\/p>\n<pre id=\"56ef\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">class Quiz extends Component {\n  \/\/ Added this:\n  constructor(props) {\n    super(props);<\/code><\/pre>\n<pre id=\"34d7\" class=\"graf graf--pre graf-after--pre\"><code class=\"\" data-line=\"\">    \/\/ Assign state itself, and a default value for items\n    this.state = {\n      items: []\n    };\n  }<\/code><\/pre>\n<pre id=\"203b\" class=\"graf graf--pre graf-after--pre\"><code class=\"\" data-line=\"\">  componentWillMount() {\n    axios.get(&#039;\/thedata&#039;).then(res =&gt; {\n      this.setState({items: res.data});\n    });\n  }<\/code><\/pre>\n<pre id=\"3201\" class=\"graf graf--pre graf-after--pre\"><code class=\"\" data-line=\"\">  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 id=\"70e2\" class=\"graf graf--p graf-after--pre graf--trailing\">The exact code in your app might be different, but we hope we\u2019ve given you enough of a clue to either fix or avoid this problem in your app. If not, keep reading because we\u2019ll cover more examples for related errors below.<\/p>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"b8b1\" class=\"graf graf--h4 graf--leading\">2. TypeError: \u2018undefined\u2019 is not an object (evaluating<\/h4>\n<p id=\"aa4b\" class=\"graf graf--p graf-after--h4 graf--trailing\">This is an error that occurs in Safari when you read a property or call a method on an undefined object. You can test this very easily in the Safari Developer Console. This is essentially the same as the above error for Chrome, but Safari uses a different error message.<\/p>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"6ec0\" class=\"graf graf--h4 graf--leading\">3. TypeError: null is not an object (evaluating<\/h4>\n<p id=\"1528\" class=\"graf graf--p graf-after--h4\">This is an error that occurs in Safari when you read a property or call a method on a null object. You can test this very easily in the Safari Developer Console.<\/p>\n<p id=\"41e7\" class=\"graf graf--p graf-after--p\">Interestingly, in JavaScript, null and undefined are not the same, which is why we see two different error messages. Undefined is usually a variable that has not been assigned, while null means the value is blank. To verify they are not equal, try using the strict equality operator:<\/p>\n<p id=\"04d3\" class=\"graf graf--p graf-after--p\">One way this error might occur in a real world example is if you try using a DOM element in your JavaScript before the element is loaded. That\u2019s because the DOM API returns null for object references that are blank.<\/p>\n<p id=\"d7a2\" class=\"graf graf--p graf-after--p\">Any JS code that executes and deals with DOM elements should execute after the DOM elements have been created. JS code is interpreted from top to down as laid out in the HTML. So, if there is a tag before the DOM elements, the JS code within script tag will execute as the browser parses the HTML page. You will get this error if the DOM elements have not been created before loading the script.<\/p>\n<p id=\"b751\" class=\"graf graf--p graf-after--p\">In this example, we can resolve the issue by adding an event listener that will notify us when the page is ready. Once the <code class=\"\" data-line=\"\">addEventListener<\/code> is fired, the <code class=\"\" data-line=\"\">init()<\/code>method can make use of the DOM elements.<\/p>\n<pre id=\"170e\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">&lt;script&gt;\n  function init() {\n    var myButton = document.getElementById(&quot;myButton&quot;);\n    var myTextfield = document.getElementById(&quot;myTextfield&quot;);\n    myButton.onclick = function() {\n      var userName = myTextfield.value;\n    }\n  }\n  document.addEventListener(&#039;readystatechange&#039;, function() {\n    if (document.readyState === &quot;complete&quot;) {\n      init();\n    }\n  });\n&lt;\/script&gt;<\/code><\/pre>\n<pre id=\"6f7f\" class=\"graf graf--pre graf-after--pre graf--trailing\"><code class=\"\" data-line=\"\">&lt;form&gt;\n  &lt;input type=&quot;text&quot; id=&quot;myTextfield&quot; placeholder=&quot;Type your name&quot; \/&gt;\n  &lt;input type=&quot;button&quot; id=&quot;myButton&quot; value=&quot;Go&quot; \/&gt;\n&lt;\/form&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"f309\" class=\"graf graf--h4 graf--leading\">4. (unknown): Script\u00a0error<\/h4>\n<p id=\"2160\" class=\"graf graf--p graf-after--h4\">The Script error occurs when an uncaught JavaScript error crosses domain boundaries in violation of the cross-origin policy. For example, if you host your JavaScript code on a CDN, any uncaught errors (errors that bubble up to the window.onerror handler, instead of being caught in try-catch) will get reported as simply \u201cScript error\u201d instead of containing useful information. This is a browser security measure intended to prevent passing data across domains that otherwise wouldn\u2019t be allowed to communicate.<\/p>\n<p id=\"4209\" class=\"graf graf--p graf-after--p\">To get the real error messages, do the following:<\/p>\n<p id=\"ea40\" class=\"graf graf--p graf-after--p\"><strong class=\"markup--strong markup--p-strong\">1. Send the Access-Control-Allow-Origin header<br \/>\n<\/strong>Setting the <code class=\"\" data-line=\"\">Access-Control-Allow-Origin<\/code> header to * signifies that the resource can be accessed properly from any domain. You can replace * with your domain if necessary: for example, <code class=\"\" data-line=\"\">Access-Control-Allow-Origin: www.example.com<\/code>. However, handling multiple domains gets tricky, and may not be worth the effort if you\u2019re using a CDN due to caching issues that may arise. See more <a class=\"markup--anchor markup--p-anchor\" href=\"http:\/\/stackoverflow.com\/questions\/1653308\/access-control-allow-origin-multiple-origin-domains\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"http:\/\/stackoverflow.com\/questions\/1653308\/access-control-allow-origin-multiple-origin-domains\"><strong class=\"markup--strong markup--p-strong\">here<\/strong><\/a>.<\/p>\n<p id=\"615e\" class=\"graf graf--p graf-after--p\">Here are some examples on how to set this header in various environments:<\/p>\n<p id=\"63ab\" class=\"graf graf--p graf-after--p\"><strong class=\"markup--strong markup--p-strong\"><em class=\"markup--em markup--p-em\">Apache<br \/>\n<\/em><\/strong>In the folders where your JavaScript files will be served from, create an\u00a0<code class=\"\" data-line=\"\">.htaccess<\/code>file with the following contents:<\/p>\n<pre id=\"b706\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">Header add Access-Control-Allow-Origin &quot;*&quot;<\/code><\/pre>\n<p id=\"cfd2\" class=\"graf graf--p graf-after--pre\"><strong class=\"markup--strong markup--p-strong\"><em class=\"markup--em markup--p-em\">Nginx<br \/>\n<\/em><\/strong>Add the add_header directive to the location block that serves your JavaScript files:<\/p>\n<pre id=\"03f7\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">location ~ ^\/assets\/ {\n    add_header Access-Control-Allow-Origin *;\n}<\/code><\/pre>\n<p id=\"ccc2\" class=\"graf graf--p graf-after--pre\"><strong class=\"markup--strong markup--p-strong\"><em class=\"markup--em markup--p-em\">HAProxy<br \/>\n<\/em><\/strong>Add the following to your asset backend where JavaScript files are served from:<\/p>\n<pre id=\"16d5\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">rspadd Access-Control-Allow-Origin:\\ *<\/code><\/pre>\n<p id=\"76d9\" class=\"graf graf--p graf-after--pre graf--trailing\"><strong class=\"markup--strong markup--p-strong\">2. Set crossorigin=\u201danonymous\u201d on the script tag<br \/>\n<\/strong>In your HTML source, for each of the scripts that you\u2019ve set the <code class=\"\" data-line=\"\">Access-Control-Allow-Origin<\/code> header for, set <code class=\"\" data-line=\"\">crossorigin=&quot;anonymous&quot;<\/code> on the SCRIPT tag. Make sure you verify that the header is being sent for the script file before adding the <code class=\"\" data-line=\"\">crossorigin<\/code> property on the script tag. In Firefox, if the <code class=\"\" data-line=\"\">crossorigin<\/code> attribute is present but the <code class=\"\" data-line=\"\">Access-Control-Allow-Origin<\/code> header is not, the script won\u2019t be executed.<\/p>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"209b\" class=\"graf graf--h4 graf--leading\">5. TypeError: Object doesn\u2019t support\u00a0property<\/h4>\n<p id=\"b8bf\" class=\"graf graf--p graf-after--h4\">This is an error that occurs in IE when you call an undefined method. You can test this in the IE Developer Console.<\/p>\n<figure id=\"5158\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\"><\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure id=\"5158\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*DvKP95jvk8HBWdXH.png\" data-width=\"864\" data-height=\"203\" data-action=\"zoom\" data-action-value=\"0*DvKP95jvk8HBWdXH.png\" data-scroll=\"native\"><a href=\"https:\/\/codeburst.io\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them-2956ce008437\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/0%2ADvKP95jvk8HBWdXH.png?w=910&#038;ssl=1\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<\/figure>\n<p id=\"9f05\" class=\"graf graf--p graf-after--figure\">This is equivalent to the error \u201cTypeError: \u2018undefined\u2019 is not a function\u201d in Chrome. Yes, different browsers can have different error messages for the same logical error.<\/p>\n<p id=\"55d1\" class=\"graf graf--p graf-after--p\">This is a common problem for IE in web applications that employ JavaScript namespacing. When this is the case, the problem 99.9% of the time is IE\u2019s inability to bind methods within the current namespace to the <code class=\"\" data-line=\"\">this<\/code> keyword. For example, if you have the JS namespace <code class=\"\" data-line=\"\">Rollbar<\/code> with the method <code class=\"\" data-line=\"\">isAwesome.<\/code>Normally, if you are within the <code class=\"\" data-line=\"\">Rollbar<\/code> namespace you can invoke the <code class=\"\" data-line=\"\">isAwesome<\/code>method with the following syntax:<\/p>\n<pre id=\"f83f\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">this.isAwesome();<\/code><\/pre>\n<p id=\"9bdd\" class=\"graf graf--p graf-after--pre\">Chrome, Firefox and Opera will happily accept this syntax. IE, on the other hand, will not. Thus, the safest bet when using JS namespacing is to always prefix with the actual namespace.<\/p>\n<pre id=\"cc26\" class=\"graf graf--pre graf-after--p graf--trailing\"><code class=\"\" data-line=\"\">Rollbar.isAwesome();<\/code><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"eba1\" class=\"graf graf--h4 graf--leading\">6. TypeError: \u2018undefined\u2019 is not a\u00a0function<\/h4>\n<p id=\"7fd1\" class=\"graf graf--p graf-after--h4\">This is an error that occurs in Chrome when you call an undefined function. You can test this in the Chrome Developer Console and Mozilla Firefox Developer Console.<\/p>\n<figure id=\"da5c\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\"><\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure id=\"da5c\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*-IS8VjbpMT7I8p0D.png\" data-width=\"864\" data-height=\"175\" data-action=\"zoom\" data-action-value=\"0*-IS8VjbpMT7I8p0D.png\" data-scroll=\"native\"><a href=\"https:\/\/codeburst.io\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them-2956ce008437\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/0%2Aj_Mgfb7JS_6qKREB.png?w=910&#038;ssl=1\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<\/figure>\n<p id=\"0238\" class=\"graf graf--p graf-after--figure\">As JavaScript coding techniques and design patterns have become increasingly sophisticated over the years, there\u2019s been a corresponding increase in the proliferation of self-referencing scopes within callbacks and closures, which are a fairly common source of this\/that confusion.<\/p>\n<p id=\"42c6\" class=\"graf graf--p graf-after--p\">Consider this example code snippet:<\/p>\n<pre id=\"813d\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">function clearBoard(){\n  alert(&quot;Cleared&quot;);\n}<\/code><\/pre>\n<pre id=\"bf0f\" class=\"graf graf--pre graf-after--pre\"><code class=\"\" data-line=\"\">document.addEventListener(&quot;click&quot;, function(){\n  this.clearBoard(); \/\/ what is \u201cthis\u201d ?\n});<\/code><\/pre>\n<p id=\"a322\" class=\"graf graf--p graf-after--pre\">If you execute the above code and then click on the page, it results in the following error \u201cUncaught TypeError: this.clearBoard is not a function\u201d. The reason is that the anonymous function being executed is in the context of the document, whereas <code class=\"\" data-line=\"\">clearBoard<\/code> is defined on the window.<\/p>\n<p id=\"168e\" class=\"graf graf--p graf-after--p\">A traditional, old-browser-compliant solution is to simply save your reference to <code class=\"\" data-line=\"\">this<\/code> in a variable that can then be inherited by the closure. For example:<\/p>\n<pre id=\"1c7a\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">var self=this;  \/\/ save reference to &#039;this&#039;, while it&#039;s still this!\ndocument.addEventListener(&quot;click&quot;, function(){\n  self.clearBoard();\n});<\/code><\/pre>\n<p id=\"7127\" class=\"graf graf--p graf-after--pre\">Alternatively, in the newer browsers, you can use the <code class=\"\" data-line=\"\">bind()<\/code> method to pass the proper reference:<\/p>\n<pre id=\"8513\" class=\"graf graf--pre graf-after--p graf--trailing\"><code class=\"\" data-line=\"\">document.addEventListener(&quot;click&quot;,this.clearBoard.bind(this));<\/code><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"dae6\" class=\"graf graf--h4 graf--leading\">7. Uncaught RangeError: Maximum call\u00a0stack<\/h4>\n<p id=\"a982\" class=\"graf graf--p graf-after--h4\">This is an error that occurs in Chrome under a couple of circumstances. One is when you call a recursive function that does not terminate. You can test this in the Chrome Developer Console.<\/p>\n<figure id=\"a1f0\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\"><\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure id=\"a1f0\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*BSdfwmEVd51FVhAA.png\" data-width=\"645\" data-height=\"287\" data-scroll=\"native\"><a href=\"https:\/\/codeburst.io\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them-2956ce008437\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/0%2ABSdfwmEVd51FVhAA.png?w=910&#038;ssl=1\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<\/figure>\n<p id=\"4a23\" class=\"graf graf--p graf-after--figure\">It may also happen if you pass a value to a function that is out of range. Many functions accept only a specific range of numbers for their input values. For example, <code class=\"\" data-line=\"\">Number.toExponential(digits)<\/code> and N<code class=\"\" data-line=\"\">umber.toFixed(digits)<\/code> accept digits from 0 to 20, and <code class=\"\" data-line=\"\">Number.toPrecision(digits)<\/code> accepts digits from 1 to 21.<\/p>\n<pre id=\"210f\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">var a = new Array(4294967295);  \/\/OK\nvar b = new Array(-1); \/\/range error<\/code><\/pre>\n<pre id=\"e95e\" class=\"graf graf--pre graf-after--pre\"><code class=\"\" data-line=\"\">var num = 2.555555;\ndocument.writeln(num.toExponential(4));  \/\/OK\ndocument.writeln(num.toExponential(-2)); \/\/range error!<\/code><\/pre>\n<pre id=\"ea2e\" class=\"graf graf--pre graf-after--pre\"><code class=\"\" data-line=\"\">num = 2.9999;\ndocument.writeln(num.toFixed(2));   \/\/OK\ndocument.writeln(num.toFixed(25));  \/\/range error!<\/code><\/pre>\n<pre id=\"c607\" class=\"graf graf--pre graf-after--pre graf--trailing\"><code class=\"\" data-line=\"\">num = 2.3456;\ndocument.writeln(num.toPrecision(1));   \/\/OK\ndocument.writeln(num.toPrecision(22));  \/\/range error!<\/code><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"bfe1\" class=\"graf graf--h4 graf--leading\">8. TypeError: Cannot read property\u00a0\u2018length\u2019<\/h4>\n<p id=\"40b9\" class=\"graf graf--p graf-after--h4\">This is an error that occurs in Chrome because of reading length property for an undefined variable. You can test this in the Chrome Developer Console.<\/p>\n<figure id=\"4bea\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\"><\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure id=\"4bea\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*j_Mgfb7JS_6qKREB.png\" data-width=\"864\" data-height=\"212\" data-action=\"zoom\" data-action-value=\"0*j_Mgfb7JS_6qKREB.png\" data-scroll=\"native\"><a href=\"https:\/\/codeburst.io\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them-2956ce008437\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/0%2AugHNbERdSu8kZuD-.png?w=910&#038;ssl=1\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<\/figure>\n<p id=\"4190\" class=\"graf graf--p graf-after--figure\">You normally find length defined on an array, but you might run into this error if the array is not initialized or if the variable name is hidden in another context. Let\u2019s understand this error with the following example.<\/p>\n<pre id=\"ed07\" class=\"graf graf--pre graf-after--p\"><code class=\"\" data-line=\"\">var testArray= [&quot;Test&quot;];<\/code><\/pre>\n<pre id=\"e8e9\" class=\"graf graf--pre graf-after--pre\"><code class=\"\" data-line=\"\">function testFunction(testArray) {\n    for (var i = 0; i &lt; testArray.length; i++) {\n      console.log(testArray[i]);\n    }\n}<\/code><\/pre>\n<pre id=\"7490\" class=\"graf graf--pre graf-after--pre\"><code class=\"\" data-line=\"\">testFunction();<\/code><\/pre>\n<p id=\"2fda\" class=\"graf graf--p graf-after--pre\">When you declare a function with parameters, these parameters become local ones. This means that even if you have variables with names <code class=\"\" data-line=\"\">testArray<\/code>, parameters with the same names within a function will still be treated as <strong class=\"markup--strong markup--p-strong\">local.<\/strong><\/p>\n<p id=\"dd84\" class=\"graf graf--p graf-after--p\">You have two ways to resolve your issue:<\/p>\n<ol class=\"postList\">\n<li id=\"d505\" class=\"graf graf--li graf-after--p\">Remove parameters in the function declaration statement (it turns out you want to access those variables that are declared outside of the function, so you don\u2019t need parameters for your function):<\/li>\n<\/ol>\n<pre id=\"adea\" class=\"graf graf--pre graf-after--li\"><code class=\"\" data-line=\"\">var testArray = [&quot;Test&quot;];\n\n\/* Precondition: defined testArray outside of a function *\/\nfunction testFunction(\/* No params *\/) {\n   for (var i = 0; i &lt; testArray.length; i++) {\n     console.log(testArray[i]);\n   }\n}\n\ntestFunction();<\/code><\/pre>\n<p id=\"b026\" class=\"graf graf--p graf-after--pre\">2. Invoke the function passing it the array that we declared:<\/p>\n<pre id=\"d54b\" class=\"graf graf--pre graf-after--p graf--trailing\"><code class=\"\" data-line=\"\">var testArray = [&quot;Test&quot;];\n\nfunction testFunction(testArray) {\n  for (var i = 0; i &lt; testArray.length; i++) {\n     console.log(testArray[i]);\n   }\n}\n\ntestFunction(testArray);<\/code><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"ab83\" class=\"graf graf--h4 graf--leading\">9. Uncaught TypeError: Cannot set\u00a0property<\/h4>\n<p id=\"1eab\" class=\"graf graf--p graf-after--h4\">When we try to access an undefined variable it always returns <code class=\"\" data-line=\"\">undefined<\/code> and we cannot get or set any property of <code class=\"\" data-line=\"\">undefined<\/code>. In that case, an application will throw \u201cUncaught TypeError cannot set property of undefined.\u201d<\/p>\n<p id=\"fd89\" class=\"graf graf--p graf-after--p\">For example, in the Chrome browser:<\/p>\n<figure id=\"6a6b\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\"><\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure id=\"6a6b\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*ugHNbERdSu8kZuD-.png\" data-width=\"864\" data-height=\"213\" data-action=\"zoom\" data-action-value=\"0*ugHNbERdSu8kZuD-.png\" data-scroll=\"native\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/0%2AugHNbERdSu8kZuD-.png?w=910&#038;ssl=1\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*ugHNbERdSu8kZuD-.png\" \/><\/div>\n<\/div>\n<\/figure>\n<p id=\"3ec0\" class=\"graf graf--p graf-after--figure graf--trailing\">If the <code class=\"\" data-line=\"\">test<\/code> object does not exist, error will throw \u201cUncaught TypeError cannot set property of undefined.\u201d<\/p>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"4d4e\" class=\"graf graf--h4 graf--leading\">10. ReferenceError: event is not\u00a0defined<\/h4>\n<p id=\"7795\" class=\"graf graf--p graf-after--h4\">This error is thrown when you try to access a variable that is undefined or is outside the current scope. You can test it very easily in Chrome browser.<\/p>\n<figure id=\"31cc\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\"><\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure id=\"31cc\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*gh09BDChWo7ffwPU.png\" data-width=\"864\" data-height=\"217\" data-action=\"zoom\" data-action-value=\"0*gh09BDChWo7ffwPU.png\" data-scroll=\"native\"><a href=\"https:\/\/codeburst.io\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them-2956ce008437\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1600\/0%2Agh09BDChWo7ffwPU.png?w=910&#038;ssl=1\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<\/figure>\n<p id=\"6cc5\" class=\"graf graf--p graf-after--figure\">If you\u2019re getting this error when using the event handling system, make sure you use the event object passed in as a parameter. Older browsers like IE offer a global variable event, and Chrome automatically attaches the event variable to the handler. Firefox will not automatically add it. Libraries like jQuery attempt to normalize this behavior. Nevertheless, it\u2019s best practice to use the one passed into your event handler function.<\/p>\n<pre id=\"94c6\" class=\"graf graf--pre graf-after--p graf--trailing\"><code class=\"\" data-line=\"\">document.addEventListener(&quot;mousemove&quot;, function (event) {\n  console.log(event);\n})<\/code><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body section--last\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h4 id=\"2fac\" class=\"graf graf--h4 graf--leading\">Conclusion<\/h4>\n<p id=\"4a8e\" class=\"graf graf--p graf-after--h4\">It turns out a lot of these are null or undefined errors. A good static type checking system like <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.typescriptlang.org\/\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"https:\/\/www.typescriptlang.org\/\">Typescript<\/a> could help you avoid them if you use the strict compiler option. It can warn you if a type is expected but has not been defined. Even without Typescript, it helps to use guard clauses to check whether objects are undefined before using them.<\/p>\n<p id=\"3228\" class=\"graf graf--p graf-after--p\">We hope you learned something new and can avoid errors in the future, or that this guide helped you solve a head scratcher. Nevertheless, even with the best practices, unexpected errors do pop up in production. It\u2019s important to have visibility into errors that affect your users, and to have good tools to solve them quickly.<\/p>\n<p id=\"50d7\" class=\"graf graf--p graf-after--p\">Rollbar gives you visibility to production JavaScript errors and gives you more context to solve them quickly. For example, it offers additional debugging features like <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.paved.com\/redirect\/8omlifenc3noi00pqbgxqwpyvjb\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.paved.com\/redirect\/8omlifenc3noi00pqbgxqwpyvjb\"><strong class=\"markup--strong markup--p-strong\">telemetry<\/strong><\/a> which tells you what happened on the user\u2019s browser leading up to the error. That\u2019s insight you don\u2019t have outside of your local developer console. Learn more in Rollbar\u2019s full list of <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.paved.com\/redirect\/jay0i730aq99utpuejcp36u9mpl\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.paved.com\/redirect\/jay0i730aq99utpuejcp36u9mpl\"><strong class=\"markup--strong markup--p-strong\">features for JavaScript applications<\/strong><\/a>.<\/p>\n<\/div>\n<\/div>\n<\/section>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">From Top 10 JavaScript errors from 1000+ projects (and how to avoid them) Most of them are caught at compile time by strongly-typed languages. Who said Eiffel? Oh, how I want not to be so busy with other issues&#8230;. \ud83d\ude41<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2018\/05\/17\/top-10-javascript-errors-from-1000-projects-and-how-to-avoid-them\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[34,50],"tags":[],"class_list":["post-4327","post","type-post","status-publish","format-standard","hentry","category-eiffel","category-javascript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-17N","jetpack-related-posts":[{"id":297,"url":"https:\/\/monodes.com\/predaelli\/2015\/06\/12\/javascript-other-languages\/","url_meta":{"origin":4327,"position":0},"title":"JavaScript + Other Languages","author":"Paolo Redaelli","date":"2015-06-12","format":"link","excerpt":"JavaScript+OtherLanguages Those slides JavaScript + Other Languages are really useful to implement an eventual Eiffel to JavaScript compiler. Well, actually it should be called transcompiler.... We could just feed the C files made by current Liberty compiler but it seems to me that passing throught C which is a procedural\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2055,"url":"https:\/\/monodes.com\/predaelli\/2017\/01\/06\/exiting-the-ivory-tower\/","url_meta":{"origin":4327,"position":1},"title":"Exiting the ivory tower","author":"Paolo Redaelli","date":"2017-01-06","format":false,"excerpt":"From \"Web Development with Bootstrap 4 and Angular 2 - Second Edition\" In one moment of compilation, a TypeScript compiler can generate a declaration file which contains only signatures of the exported types. The resulting declaration file with the extension .d.ts along with a JavaScript library or module can be\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9687,"url":"https:\/\/monodes.com\/predaelli\/2022\/10\/01\/spacevim-has-eiffel-support\/","url_meta":{"origin":4327,"position":2},"title":"SpaceVim has Eiffel support!","author":"Paolo Redaelli","date":"2022-10-01","format":false,"excerpt":"SpaceVim, a community-driven vim distribution that seeks to provide layer feature, besides turning Vim into a nifty IDE for several languages (C\/C++, Rust, Kotlin, Go, Python, Java and JavaScript plus others), it offers among the available layers one for Eiffel! \u00a0","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4677,"url":"https:\/\/monodes.com\/predaelli\/2018\/10\/22\/conditional-javascript-for-experts-hacker-noon\/","url_meta":{"origin":4327,"position":3},"title":"Conditional JavaScript for Experts \u2013 Hacker Noon","author":"Paolo Redaelli","date":"2018-10-22","format":false,"excerpt":"Mastery of conditional expressions for cleaner codes They say in Conditional JavaScript for Experts \u2013 Hacker Noon. What they are suggesting is to use side-effects of\u00a0 \"expression\", as Javascript does not separate commands and queries. Call me dogmatic but this behavior to look like a fundamental ingredient for disaster. In\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9080,"url":"https:\/\/monodes.com\/predaelli\/2022\/01\/23\/javascript-insanity\/","url_meta":{"origin":4327,"position":4},"title":"Javascript insanity?","author":"Paolo Redaelli","date":"2022-01-23","format":false,"excerpt":"On Facebook\u00a0they write I enjoy JavaScript but this is insanity Welcome to a language that has approximate math as the only math you can use. In fact 7110 \/ 100 * 100 is 7109.99999999 because the first division cannot be exactly represented with with a floating point representation. Sites like\u2026","rel":"","context":"In &quot;Fun&quot;","block_context":{"text":"Fun","link":"https:\/\/monodes.com\/predaelli\/category\/fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2022\/01\/javascript-insanity.webp?fit=520%2C372&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":9041,"url":"https:\/\/monodes.com\/predaelli\/2022\/01\/04\/is-the-macos-gui-development-scene-really-this-bad\/","url_meta":{"origin":4327,"position":5},"title":"Is the macOS GUI development scene really this bad?","author":"Paolo Redaelli","date":"2022-01-04","format":false,"excerpt":"Paul WalkerFollow on last summer asked Is the macOS GUI development scene really this bad? That's a question I'm interested in because while I've been using exclusively Linux since 1997 I strive to write portable programs. Most people are still \"shackled\" into proprietary operative systems. He enlist Swift, JavaScript, C#,\u2026","rel":"","context":"In &quot;Senza categoria&quot;","block_context":{"text":"Senza categoria","link":"https:\/\/monodes.com\/predaelli\/category\/senza-categoria\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/4327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=4327"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/4327\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=4327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=4327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=4327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}