{"id":103,"date":"2016-05-20T00:23:03","date_gmt":"2016-05-20T00:23:03","guid":{"rendered":"http:\/\/www.bhoomabrsr.com\/blog\/?p=103"},"modified":"2016-05-20T00:23:03","modified_gmt":"2016-05-20T00:23:03","slug":"javascript-closures","status":"publish","type":"post","link":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/2016\/05\/20\/javascript-closures\/","title":{"rendered":"Javascript Closures"},"content":{"rendered":"<p>Many people are looking for JavaScript learning experience simple and covering info without confusion. I thought to introduce a series of &#8216;SimpleCards&#8217; to explain JavaScript concepts in effective and efficient way. To avoid confusion on JS Closure concept I made a simple card for it.<br \/>\n<strong>Definition<\/strong> (Mozilla Docs): Closures are functions whose inner functions refer to independent (free) variables (variables that are used locally, but defined in an enclosing scope). In other words, the functions defined in the closure &#8216;remember&#8217; the environment in which they were created<br \/>\n<strong>Simply<\/strong>: A closure is a special kind of object that combines two things: a function + environment in which that function were created.<br \/>\n<strong>Pros<\/strong>:<\/p>\n<ul>\n<li>Bind a variable to an execution context<\/li>\n<li>Emulating private methods with closures<\/li>\n<\/ul>\n<p><strong>Cons<\/strong>: Unnecessarily create closures will affect script performance both in terms of<\/p>\n<ul>\n<li>Processing speed and<\/li>\n<li>Memory consumption<br \/>\n<figure id=\"attachment_108\" aria-describedby=\"caption-attachment-108\" style=\"width: 2100px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-108\" src=\"https:\/\/www.bhoomabrsr.com\/blog\/wp-content\/uploads\/2016\/05\/JSC-1.jpg\" alt=\"JavaScript Closures \" width=\"2100\" height=\"1771\" \/><figcaption id=\"caption-attachment-108\" class=\"wp-caption-text\">JavaScript Closures<\/figcaption><\/figure><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Many people are looking for JavaScript learning experience simple and covering info without confusion. I thought to introduce a series of &#8216;SimpleCards&#8217; to explain JavaScript concepts in effective and efficient way. To avoid confusion on&hellip; <a href=\"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/2016\/05\/20\/javascript-closures\/\">More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,15,19],"tags":[],"class_list":["post-103","post","type-post","status-publish","format-standard","hentry","category-closure","category-javascript","category-simplecards"],"_links":{"self":[{"href":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=103"}],"version-history":[{"count":0,"href":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/103\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bhoomabrsr.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}