<?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 Kojo Code on Medium]]></title>
        <description><![CDATA[Stories by Kojo Code on Medium]]></description>
        <link>https://medium.com/@samuelmaglodji?source=rss-ae79f52af2c5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nVOqDzQMDdEpL5lbk_t3nw.jpeg</url>
            <title>Stories by Kojo Code on Medium</title>
            <link>https://medium.com/@samuelmaglodji?source=rss-ae79f52af2c5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 20:43:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samuelmaglodji/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[Understanding Array and Object Literals in JavaScript]]></title>
            <link>https://medium.com/@samuelmaglodji/understanding-array-and-object-literals-in-javascript-0cb2f7b0dc12?source=rss-ae79f52af2c5------2</link>
            <guid isPermaLink="false">https://medium.com/p/0cb2f7b0dc12</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[object-literal]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Kojo Code]]></dc:creator>
            <pubDate>Thu, 02 Jan 2025 17:35:32 GMT</pubDate>
            <atom:updated>2025-01-02T17:35:32.047Z</atom:updated>
            <content:encoded><![CDATA[<p>When working with data in JavaScript, you’ll often come across two common ways to organize it: <strong>objects</strong> and <strong>arrays</strong>. They both let you store and organize information, but they work differently depending on what you need. Let’s break it down simply.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F5421002&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fshimmy-sumo-dancing-gif-5421002&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fy1OipzcyNewAAAAN%2Fshimmy-sumo.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/080b281f24c018936807e7a7469788e8/href">https://medium.com/media/080b281f24c018936807e7a7469788e8/href</a></iframe><h3>What Is an Array?</h3><p>An <strong>array</strong> is like a list of things, where each item is stored in order. Think of it as a row of numbered boxes, and each box can hold one piece of data.</p><p>Example:</p><pre>let fruits = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;];</pre><p>So, what happened is:</p><ul><li>The array fruits contains three items: &#39;apple&#39;, &#39;banana&#39;, and &#39;cherry&#39;.</li><li>Each item is stored in a numbered position, starting from <strong>0:<br>- </strong>fruits[0] gives you &#39;apple&#39;.<br>- fruits[1] gives you &#39;banana&#39;.</li></ul><p>Visually, something like this:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F6200697522251749414&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fthe-new-girl-d5-d5-tinder-profile-gif-6200697522251749414&amp;image=https%3A%2F%2Fmedia.tenor.com%2FVg1NizV12CYAAAAN%2Fthe-new-girl-d5-d5.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0c08389b0f384c00732d38d5707ae0f/href">https://medium.com/media/f0c08389b0f384c00732d38d5707ae0f/href</a></iframe><h3>What Is an Object?</h3><p>An <strong>object</strong> is like a collection of items stored with labels instead of numbers. Think of it as a box with compartments, where each compartment has a name.</p><p>Example:</p><pre>let person = {<br>  name: &#39;John&#39;,<br>  age: 30,<br>  hobby: &#39;reading&#39;<br>}</pre><p>Here’s what’s happening:</p><ul><li>The object person contains <strong>key-value pairs</strong>:</li><li>The key name holds the value &#39;John&#39;.</li><li>The key age holds the value 30.</li><li>The key hobby holds the value &#39;reading&#39;.</li></ul><p>Something like a toolbox with the label of every item on each drawer</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F10550835&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Ftool-tool-box-gif-10550835&amp;image=https%3A%2F%2Fmedia.tenor.com%2FRP3E5vrUAewAAAAN%2Ftool-tool-box.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4f705f703ad19690a790f07af46e8ef/href">https://medium.com/media/c4f705f703ad19690a790f07af46e8ef/href</a></iframe><h3>How Data Is Stored and Handled</h3><ol><li><strong>In Arrays</strong>:</li></ol><ul><li>Data is stored in <strong>indexed positions</strong> (numbers).</li><li>Use arrays when the order of items is important.</li><li>Example: A list of tasks for a to-do app.</li></ul><pre>let tasks = [&#39;Do laundry&#39;, &#39;Buy groceries&#39;, &#39;Clean room&#39;];<br>console.log(tasks[1]); // &#39;Buy groceries&#39;</pre><p><strong>In Objects</strong>:</p><ul><li>Data is stored in <strong>key-value pairs</strong> (labels).</li><li>Use objects when you want to describe something with details.</li><li>Example: Information about a single task.</li></ul><pre>let task = {<br>  title: &#39;Do laundry&#39;,<br>  dueDate: &#39;2025-01-10&#39;,<br>  priority: &#39;High&#39;<br>};<br>console.log(task.dueDate); // &#39;2025-01-10&#39;</pre><h3>When to Use Arrays vs. Objects</h3><p><strong>Use an Array</strong> when:</p><ul><li>You have a list of similar items.</li></ul><p>Example: A list of names or numbers.</p><p><strong>Use an Object</strong> when:</p><ul><li>You need to group related data about one thing.</li></ul><p>Example: Details about a person, product, or task.</p><h3>A Practical Example</h3><p>Let’s combine them:</p><pre>let todoList = [<br>  { title: &#39;Do laundry&#39;, dueDate: &#39;2025-01-10&#39;, priority: &#39;High&#39; },<br>  { title: &#39;Buy groceries&#39;, dueDate: &#39;2025-01-12&#39;, priority: &#39;Medium&#39; }<br>];<br>console.log(todoList[0].title); // &#39;Do laundry&#39;</pre><p>Here:</p><ul><li>The <strong>array</strong> todoList keeps the tasks in order.</li><li>Each task is stored as an <strong>object</strong>, grouping details like title and due date.</li></ul><h3>Wrapping It Up</h3><ul><li><strong>Arrays</strong> are great for lists of items in a specific order.</li><li><strong>Objects</strong> are perfect for storing details about something.</li><li>Choose the one that best fits your data!</li></ul><p>Once you understand these basics, you can combine objects and arrays to create even more powerful structures. Happy coding! 🎉</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F25960322&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fthats-pretty-much-it-dustin-henderson-gaten-matarazzo-stranger-things-thats-everything-gif-25960322&amp;image=https%3A%2F%2Fmedia.tenor.com%2FVfZiZsi-AL4AAAAN%2Fthats-pretty-much-it-dustin-henderson.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/be27f031311b31d4408d1531c32a3307/href">https://medium.com/media/be27f031311b31d4408d1531c32a3307/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0cb2f7b0dc12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Parameters and arguments in JavaScript]]></title>
            <link>https://medium.com/@samuelmaglodji/parameters-and-arguments-in-javascript-053285e1eea7?source=rss-ae79f52af2c5------2</link>
            <guid isPermaLink="false">https://medium.com/p/053285e1eea7</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[parameter]]></category>
            <category><![CDATA[functions-in-javascript]]></category>
            <category><![CDATA[arguments]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Kojo Code]]></dc:creator>
            <pubDate>Thu, 02 Jan 2025 16:31:08 GMT</pubDate>
            <atom:updated>2025-01-02T16:31:08.229Z</atom:updated>
            <content:encoded><![CDATA[<p>Two words come often when you work with functions in programming, <strong><em>parameters and arguments</em></strong><em>. </em>They are very simple concepts to understand, but they can also be a bit tricky, especially if you are new to programming. So let’s break it down and see how we can understand them better.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F21874459&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fkitty-now-im-here-what-cat-gif-21874459&amp;image=https%3A%2F%2Fmedia.tenor.com%2FlvZyUwMGFBQAAAAN%2Fkitty-now.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1bc181d9c84eb93b1b27d1f55134469/href">https://medium.com/media/f1bc181d9c84eb93b1b27d1f55134469/href</a></iframe><p>Let’s use a cooking analogy to make things very simple, and also because i like cooking</p><h3>What are Parameters?</h3><p><strong>Parameters</strong> are like the empty bowls you prepare when cooking. When you create a function, you define the parameters to tell it what kind of information it needs.</p><p>For example:</p><pre>function greet(name) {<br>  console.log(`Hello, ${name}!`);<br>}</pre><p>In this code:</p><ul><li>name is the <strong>parameter</strong>.</li><li>It’s like a blank space waiting to be filled with real information.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F833165736787573644&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fhold-up-let-him-cook-cook-him-cook-let-him-gif-833165736787573644&amp;image=https%3A%2F%2Fmedia.tenor.com%2FC4__0sQ_-4wAAAAN%2Fhold-up-let-him-cook.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b9b3b5c488d84a42bf8cac32597cfca/href">https://medium.com/media/5b9b3b5c488d84a42bf8cac32597cfca/href</a></iframe><h3>What are arguments?</h3><p>Now, when you actually cook (or use the function), you give the recipe real ingredients. These are called <strong>arguments</strong>.</p><p>For example:</p><pre>greet(&#39;John&#39;);</pre><p>Here:</p><ul><li>&#39;John&#39; is the <strong>argument</strong>.</li><li>It fills the name parameter in the function.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F4994872&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fbatman-i-see-think-thinking-pondering-gif-4994872&amp;image=https%3A%2F%2Fmedia.tenor.com%2Foc7MfKdTd3kAAAAN%2Fbatman-i-see.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/b50ba12a12144f42faa646af0e5a9b71/href">https://medium.com/media/b50ba12a12144f42faa646af0e5a9b71/href</a></iframe><h3>Now, let’s see how they worked together</h3><ul><li><strong>Parameters</strong> are what you define in the function (empty bowls).</li><li><strong>Arguments</strong> are the real values you give the function (actual ingredients).</li></ul><pre>function add(a, b) {<br>  return a + b;<br>}<br><br>console.log(add(2, 3)); // Prints: 5</pre><p>In this example:</p><ul><li>a and b are the parameters.</li><li>2 and 3 are the arguments.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F20343462&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Ffamily-matters-ah-ha-eureka-i-have-an-idea-good-idea-gif-20343462&amp;image=https%3A%2F%2Fmedia.tenor.com%2FPhbaVasV9wAAAAAN%2Ffamily-matters-ah-ha.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/579c12fa85ce5c284770c85a7b151b0e/href">https://medium.com/media/579c12fa85ce5c284770c85a7b151b0e/href</a></iframe><h3>Wrap up…</h3><p>And that’s it! Understanding <strong>parameters</strong> and <strong>arguments</strong> is like mastering a simple recipe in cooking.</p><ul><li><strong>Parameters</strong> are the placeholders for the ingredients.</li><li><strong>Arguments</strong> are the actual ingredients you add when making the recipe.</li></ul><p>When you get the hang of using them, you’ll see how powerful and flexible functions in JavaScript can be.</p><p>If you’d like to dive deeper, here are a couple of great resources to check out:</p><ol><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions">MDN Web Docs: Functions</a> — A detailed guide on how functions work in JavaScript, including parameters and arguments.</li><li><a href="https://javascript.info/">JavaScript.info</a>: Functions — A beginner-friendly explanation of functions with examples and practice problems.</li></ol><p>Now, go ahead and try creating your own functions — it’s the best way to learn! 🎉</p><p><a href="https://tenor.com/view/thats-it-that-all-folks-gif-27291397">https://tenor.com/view/thats-it-that-all-folks-gif-27291397</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=053285e1eea7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>