{"id":6745,"date":"2014-04-23T02:03:16","date_gmt":"2014-04-23T02:03:16","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/uncaught-typeerror-undefined-is-not-a-function-on-loading-jquery-min-js-collection-of-common-programming-errors\/"},"modified":"2014-04-23T02:03:16","modified_gmt":"2014-04-23T02:03:16","slug":"uncaught-typeerror-undefined-is-not-a-function-on-loading-jquery-min-js-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/uncaught-typeerror-undefined-is-not-a-function-on-loading-jquery-min-js-collection-of-common-programming-errors\/","title":{"rendered":"Uncaught TypeError: undefined is not a function on loading jquery-min.js-Collection of common programming errors"},"content":{"rendered":"<p>I just had the same message with the following code (in IcedCoffeeScript):<\/p>\n<pre><code>f = (err,cb) -&gt;\n  cb null, true\n\nawait f defer err, res\nconsole.log err if err  \n<\/code><\/pre>\n<p>This seemed to me like regular ICS code. I unfolded the await-defer construct to regular CoffeeScript:<\/p>\n<pre><code>f (err,res) -&gt;\n  console.log err if err\n<\/code><\/pre>\n<p>What really happend was that I tried to pass 1 callback function( with 2 parameters ) to function <code>f<\/code> expecting two parameters, effectively not setting <code>cb<\/code> inside <code>f<\/code>, which the compiler correctly reported as <code>undefined is not a function<\/code>.<\/p>\n<p>The mistake happened because I blindly pasted callback-style boilerplate code. <code>f<\/code> doesn&#8217;t need an <code>err<\/code> parameter passed into it, thus should simply be:<\/p>\n<pre><code>f = (cb) -&gt;\n  cb null, true\nf (err,res) -&gt;\n  console.log err if err\n<\/code><\/pre>\n<p>In the general case, I&#8217;d recommend to double-check function signatures and invocations for matching arities. The call-stack in the error message should be able to provide helpful hints.<\/p>\n<p>In your special case, I recommend looking for function definitions appearing twice in the merged file, with different signatures, or assignments to global variables holding functions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just had the same message with the following code (in IcedCoffeeScript): f = (err,cb) -&gt; cb null, true await f defer err, res console.log err if err This seemed to me like regular ICS code. I unfolded the await-defer construct to regular CoffeeScript: f (err,res) -&gt; console.log err if err What really happend was [&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-6745","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6745","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=6745"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6745\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}