<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ego on Medium]]></title>
        <description><![CDATA[Stories by Ego on Medium]]></description>
        <link>https://medium.com/@glorynwaekpe?source=rss-a47b9a5e1a10------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*p4g2L_OuNt8YE3gGz1cMwQ.jpeg</url>
            <title>Stories by Ego on Medium</title>
            <link>https://medium.com/@glorynwaekpe?source=rss-a47b9a5e1a10------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 14:44:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@glorynwaekpe/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Cherry-Pick Does Not Copy a Commit. It Replays a Decision.]]></title>
            <link>https://medium.com/@glorynwaekpe/cherry-pick-does-not-copy-a-commit-it-replays-a-decision-b5e9a913a786?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5e9a913a786</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[hacktoberfest]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Fri, 04 Sep 2026 13:34:03 GMT</pubDate>
            <atom:updated>2026-09-04T13:34:03.233Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bVUy9DmZbUZbW0Mhj9ALxg.png" /></figure><p>Let me tell you something that took me longer than I expected to fully understand.</p><p>I used to think git cherry-pick copied a commit from one branch and dropped it onto another. Clean, simple, done. That explanation is convenient. It is also not quite true.</p><p>And here is why</p><p><strong>The moment that made me question everything</strong></p><p>I was moving documentation work between two branches of a repository. The work had already been merged into one branch but was also needed on another. I did not want everything that had accumulated there, just two specific commits from one pull request.</p><p>So I created a clean branch and ran the cherry-pick. Git reported success. But the resulting commit had a completely different hash than the original.</p><p>I picked the same commit. Git gave it a new identity. Why?</p><p><strong>A commit is more than changed lines</strong></p><p>Most developers think of a commit as a bag of changes. That is close to how a pull request presents it, but it is not how Git identifies it.</p><p>A commit records a snapshot of the project plus metadata: who made it, when, what the message says, and crucially, what came before it. That last part is the one that changes everything.</p><p>The parent commit is part of the commit’s identity. It tells Git: <em>this snapshot came after that snapshot.</em> When you cherry-pick onto a different branch, your commit lands after a completely different parent. Different parent means different commit data. Different commit data means different hash.</p><p>The hash changed because the history changed.</p><p>Cherry-pick does not transport a commit intact. It takes the change introduced by that commit and replays it wherever you currently are.</p><p><strong>The destination shapes the result</strong></p><p>This became even clearer with my second cherry-pick.</p><p>The original commit had removed an old file that no longer needed to exist. But my destination branch never had that file. When Git replayed the commit there, the deletion produced nothing because there was nothing to delete.</p><p>The human intention stayed the same. The mechanical result changed because the two branches did not start from the same state.</p><p>That is what “replay” actually means. Git applies the difference between a commit and its original parent to wherever you are now. Your destination is not an empty surface, it has its own history, files, and decisions. Those conditions affect the outcome.</p><p><strong>Why not just merge?</strong></p><p>Because a merge combines histories. Cherry-pick carries intentions.</p><p>Merging would have pulled in everything that had accumulated on the source branch, unrelated commits, branch-specific decisions, things that had no business being on the destination. Even if Git produced no conflicts, the operation could still have been wrong.</p><p>No conflict does not mean the histories should be combined. It means only that Git found a mechanical path through them.</p><p>Cherry-pick gave the operation a narrower boundary: take these two changes, in this order, and replay them on the current foundation. That selectivity is the point.</p><p><strong>The command is simple. The judgment is not.</strong></p><p>The steps were short. Fetch the latest changes, create a clean branch, cherry-pick the two commits, push. Five commands. Done. But each command answered a different question.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5e9a913a786" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Clicked a Button. The Browser Saw a Tree: Event Bubbling]]></title>
            <link>https://medium.com/@glorynwaekpe/i-clicked-a-button-the-browser-saw-a-tree-event-bubbling-9a6a04026c80?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a6a04026c80</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Fri, 28 Aug 2026 10:35:38 GMT</pubDate>
            <atom:updated>2026-08-28T10:35:38.683Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ciu3LUYhQLMbTvePygdOHQ.png" /></figure><p>When I click a button, I see one small action. My pointer lands on the button, I press, I release, and the button responds. The browser sees something much larger. It sees that button as a node buried inside a structure of parents: perhaps a main element, then body, then html, all belonging to document. The button may look isolated on the screen, but inside the browser it has an address inside a family tree.</p><pre>document<br>└── html<br>    └── body<br>        └── button</pre><p>When the click happens, the browser first has to work out what I clicked. It uses the pointer’s coordinates to perform a hit test, asking which rendered element occupies that point on the screen. If the answer is the button, the browser makes that button the event’s target. It then creates a click event carrying information about the interaction, including where it happened, which mouse button was used, and which element received it.</p><p>But the browser does not see only the target. It also knows where the target lives. From the button, it can construct a path through the button’s ancestors. Once the event has reached the button, the browser begins checking that path upward: from the button to body, from body to html, and from html to document. The event path can then extend to window, even though window is not a DOM node. If any object along that path has a listener waiting for a click, that listener can run too. This upward processing is called <strong>event bubbling</strong>.</p><pre>document.addEventListener(&quot;click&quot;, function (event) {<br>  console.log(&quot;Document heard the click&quot;);<br>});</pre><p>That listener can run even though I clicked the button, because the button exists inside document. The browser is not pretending that I separately clicked every parent. It is carrying the same event through the structure that contains the target and allowing each level to respond. Bubbling is therefore less about where my finger or mouse touched the screen, and more about where that touched element belongs in the DOM.</p><p>This is why event.target and event.currentTarget can point to different things. If the click began on the button, event.target remains the button. When the event reaches the listener on document, event.currentTarget is document, because that is the object whose callback is running at that moment. One property remembers the origin. The other identifies the current listener.</p><pre>document.addEventListener(&quot;click&quot;, function (event) {<br>  console.log(event.target);        // button<br>  console.log(event.currentTarget); // document<br>});</pre><p>That is the whole idea behind event bubbling. I click one visible element, but the browser sees the invisible chain holding that element inside the page. The event begins at the button. The browser lets its ancestors hear what happened. I saw a button. The browser saw a tree.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a6a04026c80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Gets Fast by Guessing. Then Starts Over When It Guesses Wrong.]]></title>
            <link>https://medium.com/@glorynwaekpe/javascript-gets-fast-by-guessing-then-starts-over-when-it-guesses-wrong-a4cb9cc1ea4c?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4cb9cc1ea4c</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 14:13:08 GMT</pubDate>
            <atom:updated>2026-08-25T14:13:08.516Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*izgzQDNqKVzzkO6tYHzOyg.png" /></figure><p>While reading <em>You Don’t Know JS</em>, I found this line:</p><p><em>“To ensure the fastest performance, JS engines use all kinds of tricks (like JITs, which lazy compile and even hot re-compile, etc.).”</em></p><p>I stopped at <em>hot re-compile</em>.</p><p>Recompile? I thought compilation happened once. The engine reads the source, turns it into something executable, then runs it. Why would it compile the same function again while the program is already running?</p><p>Because the first compilation happened before the engine knew enough.</p><p>That is the problem at the centre of JavaScript performance. The engine must execute your code immediately, but some of the information it needs to make that code fast will only exist after the code has begun running.</p><h3>The engine cannot know what you mean yet</h3><p>Suppose you create a function that combines two values. In C, a compiler may know beforehand that both are integers and generate a direct integer addition instruction.</p><p>JavaScript gives its engine no such comfort. Those values might be numbers. They might be strings, which would turn addition into concatenation. They might be objects that must first be converted into primitive values. The same function can receive numbers during its first thousand calls and a string on call one thousand and one.</p><p>The engine could generate machinery for every possibility from the beginning. That would be safe. It would also make every operation carry the cost of cases that may never happen.</p><p>Modern engines take a more aggressive position. They wait for evidence.</p><p>Using V8 as the case study, JavaScript source is first compiled into Ignition bytecode and interpreted. While that bytecode runs, V8 collects feedback about what actually passes through the program. It sees which functions run repeatedly, what types arrive, and what shapes objects tend to have.</p><p>Code that has barely run is called cold. Code that runs repeatedly is called hot. Hot does not describe the code itself. It describes the engine’s observation that this part of the program keeps consuming execution time.</p><p>Only then does expensive optimization begin to make financial sense.</p><h3>Cold code has not earned compilation</h3><p>Lazy compilation is the other half of the strategy. The engine refuses to spend serious compilation time on a function that may never run.</p><p>A web application can download thousands of functions during startup. Many will never run in that session. Perhaps they belong to a settings screen the user never opens or an error path never reached. Fully compiling every function would spend time and memory preparing instructions the CPU may never execute.</p><p>V8 therefore does less work for many functions at first and postpones full compilation until they are needed. Its engineers found that disabling lazy compilation hurts page-load performance and increases memory use.</p><h3>The engine makes a bet</h3><p>Imagine that our combining function has now run thousands of times and every call contained numbers. The engine may decide that this path is hot and compile a specialized machine-code version based on the assumption that numbers will continue arriving. This avoids carrying the full machinery required for strings and objects.</p><p>That is the gamble. More formally, it is speculative optimization.</p><p>The optimized version contains guards that effectively ask, “Are these still numbers?” As long as the answer is yes, the specialized path remains fast.</p><p>Then a string arrives.</p><p>The guard fails. The engine abandons that optimized path, reconstructs the function’s state in a safer execution tier, and continues correctly. This is deoptimization.</p><p>The program does not break. The engine’s prediction does.</p><p>It may later compile another version using what it has now learned. So hot recompilation does not simply mean compiling the same source again. It means producing a new executable version based on runtime evidence that did not exist during the first compilation.</p><p>The engine keeps asking whether more optimization will save more time than it costs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4cb9cc1ea4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Fight Nobody Talks About: How Promises Almost Lost Before They Won]]></title>
            <link>https://medium.com/@glorynwaekpe/the-fight-nobody-talks-about-how-promises-almost-lost-before-they-won-a143999ae1a3?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/a143999ae1a3</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[jshistory]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Fri, 14 Aug 2026 11:44:42 GMT</pubDate>
            <atom:updated>2026-08-14T11:44:42.015Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FnARzqD-KRFu4NEEfaXL1w.png" /></figure><p>In the early days of the Promise debate, the opposition did not come from people who did not understand the idea.</p><p>It came from people who understood it perfectly and still disagreed.</p><h3>The debate inside the community</h3><p>While Kris Kowal was building Q and the Promises/A+ specification was taking shape, the CommonJS mailing list, the same community trying to standardise Promises, was working through serious disagreements about the design.</p><p>In March 2010, Kowal posted a new Promise specification proposal. The response was immediate.</p><p>Kris Zyp, one of the original Promises/A authors, replied: “Sorry, but I am -1 to opaque promise objects.” He thought the API was too complicated. He wanted it to stay a library, not a standard.</p><p>Kris Walker raised a practical concern: “In my experimentation with promises thus far, they are failing to give me any more advantage in managing complexity than callbacks within closures.”</p><p>This was not outsiders attacking the idea. These were the people building it. The debate was about API design, about complexity, about whether standardising this was premature.</p><p>Promises/A, Promises/B, Promises/C, three competing specifications from the same community trying to solve the same problem. The consensus that produced Promises/A+ was not handed down. It was argued into existence, line by line, in public mailing lists.</p><h3>Node.js made its position clear</h3><p>While the community worked through the design, Node.js was making a separate calculation.</p><p>Isaac Schlueter, who created npm and led Node.js, published a statement in August 2013:</p><p>“Generators and Promises are interesting and will remain a userland option. Callbacks will remain the de facto way to implement asynchrony.”</p><p>This was a governance decision, not a dismissal. Node.js controlled the most important JavaScript ecosystem in existence. Hundreds of thousands of npm packages were built on the error-first callback pattern. Schlueter was protecting that ecosystem from fragmentation.</p><p>Mikeal Rogers stated the philosophy plainly: “I was never compelled by the arguments made in favour of Promises. I don’t think that composing futures as object chains is a good idea. I still don’t think those patterns are an improvement on standard callbacks.”</p><p>Node.js was not anti-progress. It was pro-stability. And from where they stood in 2013, callbacks were stable, and Promises were a library experiment.</p><h3>What the libraries could never do</h3><p>Fifty Promise libraries existed by 2012. All of them gave you .then. All of them gave you chaining. All of them gave you error propagation. The pattern was proven. Developers used it in production.</p><p>But none of those libraries could give you await.</p><p>await is a keyword. Keywords belong to the language specification. You cannot ship a keyword in an npm package. You cannot polyfill a keyword. You cannot fork your way to a keyword.</p><p>For async/await to exist, Promises had to be in ECMAScript itself. Not in Q. Not in Bluebird. In the spec.</p><p>ES6 shipped native Promises in June 2015. ES2017 shipped async/await two years later.</p><p>In 2017, Mikeal Rogers, who had publicly opposed Promises for years, wrote this:</p><p>“With async/await you don’t have two error handling patterns. It’s all the same.”</p><p>The community debated the design. Node.js prioritised stability. TC39 standardised it anyway. And the keyword that settled the argument could only ever have come from one place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a143999ae1a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TC39 Didn’t Build Promises. The Community Did. Then Forced It Into the Language.]]></title>
            <link>https://medium.com/@glorynwaekpe/tc39-didnt-build-promises-the-community-did-then-forced-it-into-the-language-00ca588a6dd9?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/00ca588a6dd9</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Thu, 13 Aug 2026 14:06:04 GMT</pubDate>
            <atom:updated>2026-08-13T14:06:04.510Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LXWiaLc34CVRR637cwCxGg.png" /></figure><p>In the early 2000s, the JavaScript community agreed on almost nothing.</p><p>Frameworks competed. Philosophies clashed. Browser vendors did whatever they wanted. Developers wrote the same feature four different ways depending on which library they trusted. The community was fractured.</p><p>Then one problem got bad enough that everyone stopped arguing.</p><h3>The problem nobody could ignore</h3><p>Callback hell.</p><p>If you needed to get a user, then get their posts, then get the comments on those posts, then get the authors of those comments, your code looked like this:</p><p>getUser(1, function(user) {</p><p>getPosts(user.id, function(posts) {</p><p>getComments(posts[0].id, function(comments) {</p><p>getAuthors(comments[0].id, function(authors) {</p><p>// you are now four levels deep</p><p>// error handling scattered everywhere</p><p>// nobody can read this</p><p>});</p><p>});</p><p>});</p><p>});</p><p>Real production codebases had eight to ten levels. The community called it the Pyramid of Doom. Error handling was a nightmare.</p><h3>The man who started building the answer</h3><p>In 2009, a developer named Kris Kowal was not waiting for TC39 to solve it. He was building.</p><p>Kowal took ideas from older programming languages, specifically the Waterken Q library and the E programming language, and built something called Q. A full Promise implementation for JavaScript. Resolve, reject, chaining, error propagation. Everything. Written by one person. Before any specification existed. Before the language had any of it.</p><p>Q was the proof of concept. It showed that there was a better way. Developers started using it. Then other libraries appeared. Bluebird. RSVP.js by Yehuda Katz. when.js by Brian Cavalier. Each one a different team, independently arriving at the same idea.</p><p>The community was building consensus without anyone asking them to.</p><h3>The specification that changed everything</h3><p>In 2012 something happened. The developers behind Q, RSVP.js, and when.js sat down together and wrote a shared specification. Not TC39. Not Ecma. Not a browser vendor. Developers. Writing the rules for how Promises should behave so that every library would be compatible with every other library.</p><p>They called it Promises/A+.</p><p>Domenic Denicola, who was co-authoring the spec alongside Kowal, described what happened next. The specification produced over fifty compatible Promise implementations. Fifty different libraries from fifty different developers all agreeing on how Promises should work. That level of community consensus was almost unheard of in JavaScript. And it sent a message to TC39 that could not be ignored.</p><h3>The man who walked into the room and argued</h3><p>Domenic Denicola took the Promises/A+ specification and walked into TC39.</p><p>TC39, the committee of engineers from Google, Mozilla, Apple, and Microsoft who control the JavaScript language, had reservations. Promises were seen by some as too academic. Too complex for general use. A niche concept that belonged in libraries, not in the language itself.</p><p>Denicola disagreed. He argued that the fifty compatible implementations proved community consensus. He argued that Promises were needed to power ES6’s new module loading system. He kept showing up. He kept making the case.</p><p>A TC39 member later wrote on Hacker News: “Promises have always been contentious in JS and TC39, and Domenic has indeed had the patience of a saint attempting to wrangle the various points of view into a coherent proposal.”</p><h3>The opposition</h3><p>Mikeal Rogers, one of the most influential voices in the Node.js community, was direct about his position. “I was never compelled by the arguments made in favour of Promises. I don’t think that composing futures as object chains is a good idea. I still don’t think those patterns are an improvement on standard callbacks.”</p><p>Isaac Schlueter, who created npm and led Nodejs, published a statement in 2013 making Node’s position clear: “Callbacks will remain the de facto way to implement asynchrony. Promises are interesting and will remain a userland option.”</p><p>But TC39 was not Node.js. And the community had already voted.</p><h3>The language finally answers</h3><p>ES6 shipped in June 2015. Native Promises were in ECMAScript.</p><p>Not as a browser API. Not as a library. In the language specification itself. The same specification Brendan Eich had written in ten days in 1995 now contained a native word for an eventual result. For the first time JavaScript owned the concept of something that does not exist yet but will.</p><p>Brendan Eich had watched the entire debate unfold through TC39. He had tracked the Promises/A+ work, the es-discuss mailing list arguments, the community implementations. His position throughout was careful, sceptical of adding too much too quickly but aware of the community’s pain. When Promise landed in ES6 it landed with his knowledge and under his watch.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=00ca588a6dd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You Have Never Written Async JavaScript. The Browser Did It For You.]]></title>
            <link>https://medium.com/@glorynwaekpe/you-have-never-written-async-javascript-the-browser-did-it-for-you-5fdaae996c06?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fdaae996c06</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 13:23:08 GMT</pubDate>
            <atom:updated>2026-08-12T13:23:08.124Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VZNv9caWMiKcKFcgg_L-YQ.png" /></figure><p>One sentence stopped me cold while reading Kyle Simpson’s <em>You Don’t Know JS</em>.</p><p><em>“Despite clearly allowing asynchronous JS code, up until recently ES6, JavaScript itself has actually never had any direct notion of asynchrony built into it.”</em></p><p>I read it twice. It sounded wrong. I have been writing setTimeout and addEventListener and Ajax calls. That is async. So how has JavaScript never had async built into it?</p><p>Then I dug deeper. And everything changed.</p><p><strong>The thing most developers never separate</strong></p><p>JavaScript and the browser are not the same thing.</p><p>Most developers treat them as one. They are not. The JavaScript engine lives inside the browser the same way a tenant lives inside a building. The tenant can do certain things, execute functions, run loops, but the building has infrastructure the tenant does not own, electricity, a front door…</p><p>The browser’s infrastructure is where async has always lived.</p><p>When you write:</p><p>console.log(“A”);</p><p>setTimeout(function() {</p><p>console.log(“B”);</p><p>}, 1000);</p><p>console.log(“C”);</p><p>You get A, then C, then B.</p><p>Most developers explain this by saying JavaScript is asynchronous. But that is not what happened. Here is what actually happened:</p><p>JAVASCRIPT ENGINE BROWSER</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*hTQFHAhdTjV2xHVwc-jG-g.png" /></figure><p>JavaScript never waited. JavaScript handed the timer to the browser and immediately moved on to the next line. The browser managed the one second. When the time passed the browser placed the callback in a queue. JavaScript picked it up and executed it.</p><p>The waiting happened entirely outside JavaScript.</p><p>setTimeout is not JavaScript. It is a browser API. The JavaScript engine itself has never had a built-in timer. The JavaScript specification ECMAScript does not define setTimeout. The browser does. The same is true for addEventListener, for fetch, for XMLHttpRequest. Every async operation you have ever written was powered by the browser, not the language.</p><p>JavaScript just showed up at the end to execute the callback.</p><p><strong>What JavaScript actually understood before ES6</strong></p><p>The engine has always done one thing. Execute a single chunk of code at a time, when asked to. That is Kyle Simpson’s exact point.</p><p>Before ES6 there was no JavaScript keyword for waiting. No native concept of an eventual result. No way for the language itself to say, this thing does not exist yet but it will. The language had no word for that idea.</p><p>Async existed around JavaScript. The browser provided it. JavaScript consumed it through callbacks. Functions it handed over with one instruction: run this when you are done.</p><p>That was the entire system for twenty years.</p><p><strong>Then ES6 changed one specific thing</strong></p><p>In 2015 ECMAScript introduced Promise. For the first time the JavaScript language itself owned a concept for an eventual result.</p><p>Not the browser. The language.</p><p>const promise = new Promise((resolve, reject) =&gt; {</p><p>// …</p><p>});</p><p>This was different from setTimeout because Promise is defined inside the ECMAScript specification. It belongs to JavaScript. setTimeout is defined by the browser environment. It belongs to the host.</p><p>Then ES2017 gave the language async and await, syntax specifically designed for working with Promises. Now JavaScript had not just the concept but the grammar for it.</p><p>The progression took twenty two years:</p><p>1995 — callbacks only, async lived in the browser</p><p>2015 — Promise, JavaScript owns the concept</p><p>2017 — async/await, JavaScript owns the syntax</p><p><strong>But even today Promise does not do the async work</strong></p><p>Even with native Promises, the actual waiting still happens in the host environment. When you call fetch(‘/api/users’), the browser makes the network request. JavaScript immediately gets back a Promise object, a placeholder, and moves on. When the browser finishes the request it puts the callback in the queue. JavaScript picks it up. The Promise resolves.</p><p>The browser ran the errand. JavaScript held the ticket.</p><p>This is why this freezes your browser completely:</p><p>new Promise(() =&gt; {</p><p>while(true) {}</p><p>});</p><p>Because new Promise does not move code out of the JavaScript thread. The executor runs immediately and synchronously. The loop runs on the main thread. Everything stops.</p><p>Promise does not perform async work. It represents it. The host environment has always done the actual waiting. JavaScript has always just held the receipt and shown up when called.</p><p>That one separation, language versus host environment, is the thing Kyle Simpson wanted you to see. Once it clicks, everything about async JavaScript makes sense.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fdaae996c06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloning gets you the code. Forking gets you permission to change it.]]></title>
            <link>https://medium.com/@glorynwaekpe/cloning-gets-you-the-code-forking-gets-you-permission-to-change-it-d3a46f4f717f?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3a46f4f717f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[hacktoberfest]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Thu, 06 Aug 2026 12:59:09 GMT</pubDate>
            <atom:updated>2026-08-06T12:59:09.836Z</atom:updated>
            <content:encoded><![CDATA[<h3>Fork vs Clone: The Mistake That Cost Me My First Push</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rqGvbl4cGaOibTs2CBtd_A.png" /></figure><p>I kept typing git clone on repos I didn’t own, then wondering why git push kept failing with permission errors.</p><p>The confusion made sense once I saw the two operations aren’t doing the same job at all.</p><h3>What clone actually does</h3><p>git clone is a git command. It copies a repository, any repository you have read access to, onto your machine. Nothing about it involves GitHub as a platform. It works on a public repo, a private repo you’ve been granted access to, even a repo sitting on a USB drive.</p><p>git clone <a href="https://github.com/processing/p5.js-website.git">https://github.com/processing/p5.js-website.git</a></p><p>That command downloads the full history and files, connects it back to where it came from through a remote named origin, and that’s it. You have a copy. You do not, by cloning, gain permission to push changes back to the original.</p><h3>What fork actually does</h3><p>Fork isn’t a git command at all. It’s a GitHub feature, server-side, on GitHub’s platform, not something git the tool knows about. Forking creates a full copy of someone else’s repository under your own account, on GitHub’s servers, that you own and have write access to.</p><p>Once you fork processing/p5.js-website, you now have yourname/p5.js-website, sitting alongside the original, with full push access to it.</p><h3>Why open source contribution needs both</h3><p>You can’t push directly to a project you don’t own. So the actual workflow looks like this:</p><ol><li>Fork the project on GitHub. This creates your own copy under your account.</li><li>Clone your fork to your machine. This gives you a working local copy.</li><li>Add the original project as a second remote, usually named upstream, so you can pull in new changes from the real project.</li><li>Push your work to your fork (origin), then open a pull request against the original (upstream).</li></ol><p>git remote add upstream <a href="https://github.com/processing/p5.js-website.git">https://github.com/processing/p5.js-website.git</a></p><p>git fetch upstream</p><p>git pull upstream main</p><p>origin is your fork. upstream is the real project. Every fetch, pull, or push command needs to know which one it’s talking to. That’s the entire reason both remotes exist side by side.</p><p>One clean way to hold onto the distinction: clone is about getting a copy onto your machine. Fork is about getting a copy you’re allowed to write to.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3a46f4f717f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[For a string, .length counts characters. For an array, it counts elements]]></title>
            <link>https://medium.com/@glorynwaekpe/for-a-string-length-counts-characters-for-an-array-it-counts-elements-83a56b8ee15a?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/83a56b8ee15a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[pocketknowledge]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[code-newbie]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 11:05:20 GMT</pubDate>
            <atom:updated>2026-08-05T10:27:06.948Z</atom:updated>
            <content:encoded><![CDATA[<h3>Numbers Don’t Have a .length</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KigGalN8LJReoqGHTQtdEA.png" /></figure><p>I was building something small, a pyramid of hashtags, printed line by line to the console. Ten rows. Nothing complicated.</p><p>let result = 10;</p><p>let pyramid = “”;</p><p>for (let i = 1; i &lt;= result.length; i++) {</p><p>pyramid += “#”;</p><p>}</p><p>console.log(pyramid);</p><p>I ran it.</p><p>Nothing happened. No error. No pyramid either. Just… silence.</p><p>If JavaScript had thrown something at me, I would have known exactly where to look. Instead, it handed me undefined.</p><h3>What .length actually is</h3><p>.length is a property, and properties belong to specific things. Two of the most common types in JavaScript have a .length property: strings and arrays.</p><p>“hello”.length // 5</p><p>[1, 2, 3].length // 3</p><p>For a string, .length counts characters. For an array, .length counts slots, which usually matches the number of elements, but not always, since arrays can be sparse and contain gaps. Both of these types are, at their core, ordered collections of things; a string is a sequence of characters, an array is a sequence of values. Counting “how many things are in this sequence” is a natural, built-in operation for both.</p><p>A number is not a sequence of anything. 10 is a single, indivisible value. There is nothing inside it to count. So when you write:</p><p>let result = 10;</p><p>result.length</p><p>JavaScript doesn’t refuse to answer. It just checks: does this value have a property called length? No. So the answer is undefined, the value JavaScript hands you whenever you ask for something that was never defined in the first place.</p><h3>Why the loop went quiet</h3><p>Back to the pyramid code:</p><p>for (let i = 1; i &lt;= result.length; i++) {</p><p>result.length evaluates to undefined. So the loop’s actual condition, underneath the surface, is:</p><p>i &lt;= undefined</p><p>&lt;= is a comparison operator, and JavaScript comparison operators try to convert their operands into numbers before comparing. undefined, converted to a number, becomes NaN, “Not a Number,” JavaScript’s way of saying “this couldn’t be turned into a real number.”</p><p>And here’s the rule: any relational comparison involving NaN is always false. 1 &lt;= NaN is false. 100 &lt;= NaN is false. So the loop checks its condition once, gets false immediately, and never runs, not even a single time.</p><h3>The fix</h3><p>let result = 10;</p><p>let pyramid = “”;</p><p>for (let i = 1; i &lt;= result; i++) {</p><p>pyramid += “#” + “\n”;</p><p>}</p><p>console.log(pyramid);</p><p>Compare directly against the number itself, result, not a property that was never there.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83a56b8ee15a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What a Function Actually Is, Because Nobody Explained It at the Engineering Level]]></title>
            <link>https://medium.com/@glorynwaekpe/what-a-function-actually-is-because-nobody-explained-it-at-the-engineering-level-84bd498b9e89?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/84bd498b9e89</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Wed, 15 Jul 2026 15:03:51 GMT</pubDate>
            <atom:updated>2026-07-15T15:35:15.561Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pkuwFcZeKvZFjmX1ZUMq0g.png" /></figure><p>Most people learn what a function does without ever stopping to understand what a function actually is. That gap is small until it is not. Until you are staring at code that should work and it does not, and you cannot explain why.</p><h3>What a Function Actually Is</h3><p>A function is a set of instructions with a label on it. That is it. You write the instructions once, give them a name, and then you can run those instructions whenever you want, as many times as you want, from anywhere in your code.</p><p>Without functions, every time you needed to do the same thing, you would write the same code again. Twice. Ten times. A hundred times. And every time you needed to change something, you would have to find every single copy and change each one.</p><p>Functions solve that. Write it once. Use it everywhere.</p><p>function greet() {</p><p>console.log(“Hello, welcome back”)</p><p>}</p><p>greet() // Hello, welcome back</p><p>greet() // Hello, welcome back</p><p>greet() // Hello, welcome back</p><p>One set of instructions. Called three times. That is the first power of a function, reusability.</p><h3>The Anatomy of a Function</h3><p>There are three parts worth knowing by name because you will hear them constantly.</p><p><strong>The definition.</strong> This is where you write the instructions. The function does not run here. You are just describing what it will do when called.</p><p>function greet() {</p><p>console.log(“Hello”) // this is the definition</p><p>}</p><p><strong>The invocation.</strong> This is where you actually run it. You call the function by its name followed by parentheses. The parentheses are the instruction to execute.</p><p>greet() // this is the invocation</p><p>The difference between greet and greet() matters enormously. greet is just a reference to the function, the instructions sitting there waiting. greet() is you actually telling JavaScript to run it.</p><p><strong>The parameter.</strong> A function can accept input. That input has a placeholder name inside the parentheses called a parameter. When you call the function and pass an actual value, that value is called an argument.</p><p>function greet(name) { // name is the parameter</p><p>console.log(“Hello “ + name)</p><p>}</p><p>greet(“Ego”) // “Ego” is the argument</p><p>// Hello Ego</p><p>The parameter is the variable that lives inside the function. The argument is the real value you hand it when you call it. Same slot, different words depending on where you are standing.</p><h3>Named and Anonymous</h3><p>A function does not have to have a name. This is one of the things that separates JavaScript from a lot of other languages, and it matters more than it sounds.</p><p>A named function looks like what you have seen above:</p><p>function greet() {</p><p>console.log(“Hello”)</p><p>}</p><p>An anonymous function has no name. It is just the instructions, stored in a variable or passed directly to something else:</p><p>const greet = function() {</p><p>console.log(“Hello”)</p><p>}</p><p>Or as an arrow function, the modern shorthand:</p><p>const greet = () =&gt; {</p><p>console.log(“Hello”)</p><p>}</p><p>You have been using anonymous functions every time you wrote an event listener:</p><p>btn.addEventListener(“click”, function() {</p><p>// this function has no name</p><p>})</p><p>That function passed to addEventListener is anonymous. You never gave it a label. You handed it directly to something else and said, run this when the button is clicked.</p><h3>A Function Is a Value</h3><p>In JavaScript, a function is not just something you call. It is a value. The same way a number is a value and a string is a value, a function is a value.</p><p>That means you can store it in a variable:</p><p>const greet = function() {</p><p>console.log(“Hello”)</p><p>}</p><p>You can pass it to another function as an argument:</p><p>btn.addEventListener(“click”, greet)</p><p>You can return it from another function. This is what makes JavaScript genuinely powerful, and it is the foundation of everything you will build as a frontend engineer. Not just someone who writes code, but someone who understands why the code works.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84bd498b9e89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[innerHTML vs textContent: The Difference That Could Get Your Users Hacked]]></title>
            <link>https://medium.com/@glorynwaekpe/innerhtml-vs-textcontent-the-difference-that-could-get-your-users-hacked-451a29b65760?source=rss-a47b9a5e1a10------2</link>
            <guid isPermaLink="false">https://medium.com/p/451a29b65760</guid>
            <category><![CDATA[xss-attack]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[100daysofcode]]></category>
            <dc:creator><![CDATA[Ego]]></dc:creator>
            <pubDate>Wed, 24 Jun 2026 13:16:22 GMT</pubDate>
            <atom:updated>2026-06-24T13:16:22.946Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nf6n0w3UaznmR-qunIK9ww.png" /></figure><p>You have probably used both without thinking twice. You needed to put something on the page, you picked one, it worked, you moved on. Most developers do.</p><p>But there is a real difference between these two. Not just syntax. Not just style. One of them can get your users hacked if you use it in the wrong place. And the scary part is the browser will not warn you. It will just quietly execute whatever you put in.</p><p>So let us actually talk about what these things are.</p><h3>textContent: The Safe One</h3><p>textContent sets or reads the plain text inside an element. Everything you pass to it gets treated as text. Nothing more.</p><p>element.textContent = “Hello Ego”</p><p>Simple. Works exactly as you expect. But here is the part worth knowing:</p><p>element.textContent = “&lt;strong&gt;Hello&lt;/strong&gt;”</p><p>// displays literally on screen: &lt;strong&gt;Hello&lt;/strong&gt;</p><p>// does not make text bold</p><p>You tried to pass HTML. textContent did not care. It displayed those tags as plain characters on the screen. No rendering. No parsing. Just text. That behaviour is exactly what makes it safe.</p><h3>innerHTML: The Powerful One</h3><p>innerHTML actually parses what you give it and renders it as HTML.</p><p>element.innerHTML = “&lt;strong&gt;Hello&lt;/strong&gt;”</p><p>// renders: Hello in bold</p><p>That is useful when you genuinely need to insert HTML structure, not just text. But here is where things get serious. Imagine you build a comment section. A user types something and you display it using innerHTML:</p><p>const userComment = “&lt;script&gt;alert(‘I stole your cookies’)&lt;/script&gt;”</p><p>commentBox.innerHTML = userComment</p><p>You just dropped a script tag directly into the DOM. The browser reads it, sees a script tag, and executes it. Now that attacker’s code is running on your page with full access to everything JavaScript can touch, session data, cookies, login tokens.</p><p>And it gets worse. Script tags are not even the only way in.</p><p>commentBox.innerHTML = “&lt;img src=’x’ onerror=’stealData()’&gt;”</p><p>The image source does not exist so it errors. The onerror attribute fires. JavaScript runs. No script tag needed.</p><p>commentBox.innerHTML = “&lt;a href=’javascript:stealData()’&gt;Click here for prize&lt;/a&gt;”</p><p>Looks like a normal link. User clicks it. Code runs.</p><p>The danger has a name. XSS, Cross Site Scripting. And what makes it genuinely unsettling is that none of those examples above look dangerous at first glance. A comment. An image. A link. The browser does not question any of it. It just executes. If user content touches innerHTML, you have handed an attacker the keys to everything JavaScript can reach on your page.</p><h3>So How Do You Display Safely?</h3><p>If you are displaying plain text, a string, a number, a counter value, a hex colour, textContent is exactly right.</p><p>element.textContent = “Hello Ego”</p><p>element.textContent = count</p><p>element.textContent = hex</p><p>If you need to display actual HTML structure, bold text, a link, a list item, build the elements yourself in JavaScript:</p><p>const strong = document.createElement(“strong”)</p><p>strong.textContent = “Hello Ego”</p><p>element.appendChild(strong)</p><p>You create the element. You set its text safely with textContent. You append it. No user input ever touches innerHTML. No attack surface.</p><p>If the content is entirely your own code and you know exactly what is in it, innerHTML is fine:</p><p>element.innerHTML = “&lt;strong&gt;Hello Ego&lt;/strong&gt;”</p><p>But the moment that content comes from a user, a form input, a URL parameter, anything typed by someone outside your own code, stay away from innerHTML. If you absolutely must use it with dynamic content, sanitise it first:</p><p>commentBox.innerHTML = DOMPurify.sanitize(userComment)</p><h3>A Quick History Worth Knowing</h3><p>innerHTML came first. Microsoft introduced it in Internet Explorer 4 in 1997. It was not part of any official standard. Microsoft just built it, other browsers copied it because developers used it everywhere, and it became a de facto feature of the web.</p><p>textContent came later, in 2004, as part of the official DOM Level 3 specification. It was introduced specifically because innerHTML was dangerous and developers needed a safe way to put plain text on the page without the security risk.</p><p>Microsoft shipped it without a standard, every browser copied it because developers were already using it everywhere, and the web just absorbed the decision. Seven years later the official spec introduced textContent specifically to give developers a way out. The older tool worked but created problems nobody anticipated. The safer one arrived to clean them up.</p><p>The pattern is familiar. var came before let and const. innerHTML came before textContent. The older tool worked but had problems. The safer one came to fix them.</p><p>There is no warning. No error. No red flag in the console. The browser will not stop you from making the wrong choice. That part is on you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=451a29b65760" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>