<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>JavaScript Fundamentals on Coderrob</title><link>https://coderrob.com/tags/javascript-fundamentals/</link><description>Recent content in JavaScript Fundamentals on Coderrob</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Mon, 27 Apr 2026 11:30:00 -0500</lastBuildDate><atom:link href="https://coderrob.com/tags/javascript-fundamentals/index.xml" rel="self" type="application/rss+xml"/><item><title>JavaScript Arrow Functions Explained</title><link>https://coderrob.com/posts/javascript-arrow-functions-explained/</link><pubDate>Mon, 27 Apr 2026 11:30:00 -0500</pubDate><guid>https://coderrob.com/posts/javascript-arrow-functions-explained/</guid><description>&lt;p&gt;Arrow functions are compact JavaScript functions with a few deliberate differences from ordinary functions.&lt;/p&gt;
&lt;p&gt;They are excellent for small transformations and callbacks. They are not a universal replacement for &lt;code&gt;function&lt;/code&gt;, and treating them like one hides the exact behavior that makes them useful.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Use an arrow when you want a concise function and do not need the function to define its own &lt;code&gt;this&lt;/code&gt;, &lt;code&gt;arguments&lt;/code&gt;, or constructor behavior.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="the-basic-syntax"&gt;The Basic Syntax&lt;/h2&gt;
&lt;p&gt;An ordinary function expression looks like this:&lt;/p&gt;</description></item><item><title>JavaScript 'this' Explained</title><link>https://coderrob.com/posts/javascript-this-explained/</link><pubDate>Mon, 27 Apr 2026 11:00:00 -0500</pubDate><guid>https://coderrob.com/posts/javascript-this-explained/</guid><description>&lt;p&gt;JavaScript&amp;rsquo;s &lt;code&gt;this&lt;/code&gt; is not difficult because it does many things. It is difficult because one small word changes value based on &lt;strong&gt;how a function is called&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;That makes &lt;code&gt;this&lt;/code&gt; look unpredictable when the real problem is usually that we are looking in the wrong place.&lt;/p&gt;
&lt;p&gt;For an ordinary function, do not start with where the function was written. Start with the call-site.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The call usually decides &lt;code&gt;this&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That one rule explains most of the behavior you will meet in day-to-day JavaScript.&lt;/p&gt;</description></item><item><title>JavaScript Closures and Modified Closures Explained</title><link>https://coderrob.com/posts/javascript-closures-and-modified-closures-explained/</link><pubDate>Mon, 27 Apr 2026 10:00:00 -0500</pubDate><guid>https://coderrob.com/posts/javascript-closures-and-modified-closures-explained/</guid><description>&lt;p&gt;Closures show up any time a JavaScript function uses a variable defined from outside its own curly braces.&lt;/p&gt;
&lt;p&gt;That makes them common in callbacks, event handlers, timers, factory functions, and plenty of code that passes functions around.&lt;/p&gt;
&lt;p&gt;This post is about two questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;What is a closure?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What happens when a closed-over variable is modified before the function uses it?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The short version:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A closure happens when a function keeps access to variables from its surrounding scope, even after that outer scope has finished running.&lt;/p&gt;</description></item><item><title>JavaScript Hoisting Explained</title><link>https://coderrob.com/posts/javascript-hoisting-explained/</link><pubDate>Sun, 26 Apr 2026 10:00:00 -0500</pubDate><guid>https://coderrob.com/posts/javascript-hoisting-explained/</guid><description>&lt;p&gt;Hoisting is JavaScript&amp;rsquo;s setup behavior for declarations.&lt;/p&gt;
&lt;p&gt;It affects whether a function or variable can be used before the line where it appears in the file. That matters because &lt;code&gt;function&lt;/code&gt;, &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt;, and &lt;code&gt;const&lt;/code&gt; do not all behave the same way.&lt;/p&gt;
&lt;p&gt;This post is about two questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;When does JavaScript create the name?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What value, if any, is available before the declaration line runs?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Hoisting is usually explained as &amp;ldquo;JavaScript moves declarations to the top.&amp;rdquo;&lt;/p&gt;</description></item><item><title>JavaScript Var, Let, and Const Explained</title><link>https://coderrob.com/posts/javascript-var-let-and-const-explained/</link><pubDate>Sat, 25 Apr 2026 10:00:00 -0500</pubDate><guid>https://coderrob.com/posts/javascript-var-let-and-const-explained/</guid><description>&lt;p&gt;Most JavaScript code starts with a simple act: you give a value a name. We call that a variable declaration.&lt;/p&gt;
&lt;p&gt;That sounds small, but the way you create that name affects how the rest of your code can use it. A variable might be available only inside a small &amp;ldquo;if&amp;rdquo; block, across an entire function, or in places you did not really mean to share it.&lt;/p&gt;
&lt;p&gt;That is why &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt;, and &lt;code&gt;const&lt;/code&gt; are worth understanding before the code gets complicated.&lt;/p&gt;</description></item><item><title>JavaScript Promise</title><link>https://coderrob.com/posts/javascript-promise/</link><pubDate>Wed, 22 Oct 2025 21:00:00 -0500</pubDate><guid>https://coderrob.com/posts/javascript-promise/</guid><description>&lt;p&gt;A &lt;code&gt;Promise&lt;/code&gt; is a guaranteed placeholder value for what a function or series of functions will return.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a &lt;em&gt;promise&lt;/em&gt; to return a value eventually.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The function swears this time is different. You can trust it. It swears it&amp;rsquo;ll get it back to you in no time.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you haven&amp;rsquo;t already, check out my post on &lt;a href="../javascript-callbacks"&gt;JavaScript Callbacks&lt;/a&gt; where we dove into callback hell and why we desperately needed something better. Spoiler: Promises are that something better.&lt;/p&gt;</description></item><item><title>JavaScript Spread Syntax Explained</title><link>https://coderrob.com/posts/javascript-spread-syntax-explained/</link><pubDate>Thu, 03 Mar 2022 21:28:27 -0600</pubDate><guid>https://coderrob.com/posts/javascript-spread-syntax-explained/</guid><description>&lt;p&gt;JavaScript&amp;rsquo;s spread syntax, &lt;code&gt;...&lt;/code&gt;, lets you expand one value into another context. It is small, useful, and easy to misunderstand.&lt;/p&gt;
&lt;p&gt;The practical version is this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In an array literal, spread adds values from an iterable.&lt;/li&gt;
&lt;li&gt;In a function call, spread passes values from an iterable as separate arguments.&lt;/li&gt;
&lt;li&gt;In an object literal, spread copies an object&amp;rsquo;s own enumerable properties.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Spread expands a source into the place where you use it.&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>JavaScript Callbacks</title><link>https://coderrob.com/posts/javascript-callbacks/</link><pubDate>Mon, 03 May 2021 15:00:00 -0500</pubDate><guid>https://coderrob.com/posts/javascript-callbacks/</guid><description>&lt;h2 id="brief-history-of-callbacks"&gt;Brief History of Callbacks&lt;/h2&gt;
&lt;p&gt;It all starts with the callback function.&lt;/p&gt;
&lt;p&gt;A callback function is just a plain JavaScript function that is passed into another function as an argument.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s it. Nothing special.&lt;/p&gt;
&lt;p&gt;This callback function can be used to return data, or to signal that some event took place.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;ve worked with web development you&amp;rsquo;ve definitely crossed paths with callbacks.&lt;/p&gt;
&lt;p&gt;Think of a button &lt;code&gt;click&lt;/code&gt; event for a web page.&lt;/p&gt;</description></item><item><title>JavaScript Function Parameters and Arguments Explained</title><link>https://coderrob.com/posts/javascript-function-parameters-and-arguments-explained/</link><pubDate>Thu, 17 Sep 2020 00:46:15 -0500</pubDate><guid>https://coderrob.com/posts/javascript-function-parameters-and-arguments-explained/</guid><description>&lt;h2 id="javascript-function-signatures"&gt;JavaScript Function Signatures&lt;/h2&gt;
&lt;p&gt;Alright, you&amp;rsquo;ve probably seen functions before. Something like this maybe?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#000;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f00"&gt;function&lt;/span&gt; doSomething(name, desc, task) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#0f0"&gt;// did something
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This function, named &lt;code&gt;doSomething&lt;/code&gt;, takes three &lt;code&gt;parameters&lt;/code&gt; as part of its function signature. These parameters named &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;desc&lt;/code&gt;, and &lt;code&gt;task&lt;/code&gt; are the names of the values being sent into the function.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m going to use a sportsball reference here so be warned. You can think of the function as a net that gets various types of objects tossed into the hoop &lt;code&gt;( )&lt;/code&gt; where it triggers sports points.&lt;/p&gt;</description></item></channel></rss>