{"id":995,"date":"2022-08-30T15:10:38","date_gmt":"2022-08-30T15:10:38","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/whats-with-the-random-javascript-errors-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:10:38","modified_gmt":"2022-08-30T15:10:38","slug":"whats-with-the-random-javascript-errors-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/whats-with-the-random-javascript-errors-collection-of-common-programming-errors\/","title":{"rendered":"What&#39;s with the random Javascript errors?-Collection of common programming errors"},"content":{"rendered":"<p>OK. While it&#8217;s more or less impossible to give a reasonable solution to such a general question, I&#8217;ll just add my 2 cents&#8217; worth:<\/p>\n<p>One possible source of <em>&#8220;undefined variable&#8221;<\/em> errors comes from including several scripts, which may or may not always load and execute in the same order. If you define a variable in one script (let&#8217;s call that script <code>declare.js<\/code>) and use it in another (let&#8217;s say <code>use.js<\/code>), and <code>use.js<\/code> is executed before <code>declare.js<\/code>, then you will get such an error. If the scripts execute the other way around, everything will appear fine.<\/p>\n<p>If you&#8217;re interested in this very topic, have a look at e.g. Steve Souders&#8217; book <em>Even faster web sites<\/em>, published by O&#8217;Reilly. More specifically, look at the chapter about non-blocking script loading.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:11:58. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>OK. While it&#8217;s more or less impossible to give a reasonable solution to such a general question, I&#8217;ll just add my 2 cents&#8217; worth: One possible source of &#8220;undefined variable&#8221; errors comes from including several scripts, which may or may not always load and execute in the same order. If you define a variable in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-995","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/995","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=995"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/995\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}