{"id":985,"date":"2022-08-30T15:10:28","date_gmt":"2022-08-30T15:10:28","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/second-prototype-of-an-anonymous-and-named-function-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:10:28","modified_gmt":"2022-08-30T15:10:28","slug":"second-prototype-of-an-anonymous-and-named-function-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/second-prototype-of-an-anonymous-and-named-function-collection-of-common-programming-errors\/","title":{"rendered":"Second prototype of an anonymous and named function-Collection of common programming errors"},"content":{"rendered":"<p>Why would <code>b.prototype.prototype<\/code> be defined?<\/p>\n<pre><code>var a = function () {};\n\na.prototype; \/\/ {}\n\nfunction b () {}\n\nb.prototype; \/\/ {}\n<\/code><\/pre>\n<p>Neither prototype has a property called prototype&#8230;<br \/>\nAs such, asking for a nonextant property of an object results in <code>undefined<\/code>.<\/p>\n<p>The fact that the console is calling <code>b.prototype<\/code> <code>\"b{}\"<\/code> doesn&#8217;t change anything. It&#8217;s just saying that it&#8217;s the prototype object of the named-funciton <code>b<\/code>, rather than an anonymous function, like the one assigned to <code>a<\/code>.<\/p>\n<p>It&#8217;s still an empty object, without a prototype.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:11:03. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Why would b.prototype.prototype be defined? var a = function () {}; a.prototype; \/\/ {} function b () {} b.prototype; \/\/ {} Neither prototype has a property called prototype&#8230; As such, asking for a nonextant property of an object results in undefined. The fact that the console is calling b.prototype &#8220;b{}&#8221; doesn&#8217;t change anything. It&#8217;s just [&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-985","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/985","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=985"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/985\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}