<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Higher-Order-Functions on Ghafoor's Personal Blog</title><link>https://ghafoorsblog.com/tags/higher-order-functions/</link><description>Recent content in Higher-Order-Functions on Ghafoor's Personal Blog</description><generator>Hugo</generator><language>en</language><managingEditor>hello@ghafoorsblog.com (AG Sayyed)</managingEditor><webMaster>hello@ghafoorsblog.com (AG Sayyed)</webMaster><copyright>Copyright © 2024-2026 AG Sayyed. All Rights Reserved.</copyright><lastBuildDate>Sun, 24 May 2026 09:13:13 +0100</lastBuildDate><atom:link href="https://ghafoorsblog.com/tags/higher-order-functions/index.xml" rel="self" type="application/rss+xml"/><item><title>JavaScript Functions in Depth — Closures, this, and Higher-Order Patterns</title><link>https://ghafoorsblog.com/posts/js/05b-functions-advanced/</link><pubDate>Thu, 26 Jun 2025 08:00:00 +0000</pubDate><author>hello@ghafoorsblog.com (AG Sayyed)</author><guid>https://ghafoorsblog.com/posts/js/05b-functions-advanced/</guid><description>&lt;h2 id="beyond-the-basics"&gt;Beyond the basics&lt;/h2&gt;
&lt;p&gt;The &lt;a
 href="https://ghafoorsblog.com/posts/js/05a-functions-basics/"
 
 &gt;previous post&lt;/a&gt; covered how functions are defined and called. This one tackles the parts that come up in every interview and every code review: &lt;strong&gt;closures&lt;/strong&gt;, the &lt;strong&gt;&lt;code&gt;this&lt;/code&gt; binding&lt;/strong&gt;, and the &lt;strong&gt;higher-order patterns&lt;/strong&gt; that make JavaScript expressive.&lt;/p&gt;
&lt;h2 id="closures"&gt;Closures&lt;/h2&gt;
&lt;p&gt;A &lt;em&gt;closure&lt;/em&gt; is the combination of a function and the lexical environment it was created in. When a function is created, it captures references to every variable it can see at that moment. Those variables remain alive for as long as the function does — even after the outer scope has otherwise been garbage-collected.&lt;/p&gt;</description></item></channel></rss>