<?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 ayo osota on Medium]]></title>
        <description><![CDATA[Stories by ayo osota on Medium]]></description>
        <link>https://medium.com/@osotaayomikun?source=rss-5a0a1f258247------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*k-olozWLucT4buIlwJi6KA.jpeg</url>
            <title>Stories by ayo osota on Medium</title>
            <link>https://medium.com/@osotaayomikun?source=rss-5a0a1f258247------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 22:14:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@osotaayomikun/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[The Power of JavaScript’s ‘Map’ and ‘Set’ Objects]]></title>
            <link>https://medium.com/@osotaayomikun/the-power-of-javascripts-map-and-set-objects-621d375929e1?source=rss-5a0a1f258247------2</link>
            <guid isPermaLink="false">https://medium.com/p/621d375929e1</guid>
            <dc:creator><![CDATA[ayo osota]]></dc:creator>
            <pubDate>Tue, 13 Aug 2024 15:18:40 GMT</pubDate>
            <atom:updated>2024-08-13T15:18:40.466Z</atom:updated>
            <content:encoded><![CDATA[<p>Map and Set objects can offer more efficient alternatives to plain objects or arrays in certain scenarios.</p><h3>Understanding Map</h3><p>Imagine you’re working on an admin dashboard that tracks various actions performed by users, such as editing their profiles, uploading documents, or making transactions. The backend sends you an array of event logs for each user, with each log containing a timestamp and action details. Your task is to display only the most recent log for each action, as older logs are no longer relevant.</p><p>You can use Map to store the latest log for each action, with actionType as the key. As you iterate through the array of logs, you compare the timestamp of the current log with the one stored in the Map. If the current log is more recent, you update the Map with the new log.</p><pre>const eventLogs = [<br>    { userId: &#39;user123&#39;, <br>      actionType: &#39;editProfile&#39;, <br>      timestamp: &#39;2024-08-10T10:15:30.000Z&#39;, <br>      details: &#39;Changed avatar&#39; <br>      },<br>    { userId: &#39;user123&#39;, <br>      actionType: &#39;uploadDocument&#39;, <br>      timestamp: &#39;2024-08-10T11:00:00.000Z&#39;, <br>      details: &#39;Uploaded resume&#39; <br>      },<br>    { userId: &#39;user123&#39;, <br>      actionType: &#39;editProfile&#39;, <br>      timestamp: &#39;2024-08-10T12:45:30.000Z&#39;, <br>      details: &#39;Updated bio&#39; <br>      }, // Latest editProfile<br>    { userId: &#39;user123&#39;, <br>      actionType: &#39;uploadDocument&#39;, <br>      timestamp: &#39;2024-08-10T12:00:00.000Z&#39;, <br>      details: &#39;Uploaded cover letter&#39; <br>      }, // Latest uploadDocument<br>    { userId: &#39;user123&#39;, <br>      actionType: &#39;makePurchase&#39;, <br>      timestamp: &#39;2024-08-10T13:30:45.000Z&#39;, <br>      details: &#39;Purchased a subscription&#39; <br>      }<br>];<br><br>const latestEventLogMap = new Map();<br><br>eventLogs.forEach(log =&gt; {<br>    const currentLog = latestEventLogMap.get(log.actionType);<br><br>    if (!currentLog || new Date(log.timestamp) &gt; new Date(currentLog.timestamp)) {<br>        latestEventLogMap.set(log.actionType, log);<br>    }<br>});<br><br>// Display the latest event logs<br>latestEventLogMap.forEach((log, actionType) =&gt; {<br>    console.log(`Action: ${actionType}, Timestamp: ${log.timestamp}, Details: ${log. Details}`);<br>});</pre><p>The Map object is a collection of key-value pairs where both keys and values can be of any data type.</p><h3>Key Features of Map:</h3><ol><li>Key can be of any data type</li><li>No duplicate keys</li><li>The insertion order of keys is maintained.</li><li>Map has a size property that returns the number of entries.</li><li>Map is iterable, allowing easy looping through key-value pairs.</li><li>Map provides better performance for scenarios involving frequent additions and removals of key-value pairs.</li></ol><pre>// Creating a new Map<br>const myMap = new Map();<br><br>// Setting key-value pairs<br>myMap.set(&#39;key&#39;, &#39;value&#39;);<br>myMap.set(123, &#39;another value&#39;);<br>myMap.set(true, &#39;boolean value&#39;);<br>myMap.set(true, &#39;another boolean value&#39;); // The Map will only store one entry with the key true. The last entry,<br><br>// Retrieving values<br>console.log(myMap.get(&#39;key&#39;)); // Outputs: value<br>console.log(myMap.get(123)); // Outputs: another value<br>console.log(myMap.get(true)); // Outputs: boolean value<br><br>// Checking the size of the Map<br>console.log(myMap.size); // Outputs: 3<br><br>// Iterating over the Map<br>for (const [key, value] of myMap) {<br>    console.log(`${key}: ${value}`);<br>}<br>// Outputs:<br>// key: value<br>// 123: another value<br>// true: another Boolean value</pre><h3>Understanding Set</h3><p>Imagine you’re working on an e-commerce analytics dashboard that tracks product purchases. The backend sends you a list of transactions, where each transaction includes a userId and the product purchased. Your goal is to create a list of unique users who have bought a specific product, even if some users have bought it more than once.</p><p>The Set object is ideal for this scenario because it automatically removes duplicates. By storing each userId in a Set, you can easily compile a list of unique users who have purchased the product.</p><pre>const transactions = [<br>    { userId: &#39;user1&#39;, productId: &#39;productA&#39; },<br>    { userId: &#39;user2&#39;, productId: &#39;productA&#39; },<br>    { userId: &#39;user1&#39;, productId: &#39;productA&#39; }, // Duplicate purchase by user1<br>    { userId: &#39;user3&#39;, productId: &#39;productA&#39; },<br>    { userId: &#39;user2&#39;, productId: &#39;productB&#39; }, // Different product<br>    { userId: &#39;user4&#39;, productId: &#39;productA&#39; }<br>];<br><br>// Store unique userIds in a Set<br>const uniquePurchasers = new Set();<br><br>transactions.forEach(transaction =&gt; {<br>    if (transaction.productId === &#39;productA&#39;) {<br>        uniquePurchasers.add(transaction.userId);<br>    }<br>});<br><br>// Display the list of unique users who bought productA<br>console.log([...uniquePurchasers]); // Outputs: [&#39;user1&#39;, &#39;user2&#39;, &#39;user3&#39;, &#39;user4&#39;]</pre><p>The Map object is a collection of key-value pairs where both keys and values can be of any data type.</p><h3>Key Features of Set:</h3><ol><li>Each value in a Set must be unique.</li><li>Values can be of any data type.</li><li>Set has a size property that returns the number of values.</li><li>Set is iterable, allowing easy looping through its values.</li></ol><pre>// Creating a new Set with initial values<br>const mySet = new Set([1, 2, 3, 3, 4]);<br><br>// Adding values<br>mySet.add(5);<br>mySet.add(2); // Duplicate value, will not be added<br><br>// Checking the size of the Set<br>console.log(mySet.size); // Outputs: 5<br><br>// Checking for the presence of a value<br>console.log(mySet.has(3)); // Outputs: true<br>console.log(mySet.has(10)); // Outputs: false<br><br>// Iterating over the Set<br>for (const value of mySet) {<br>    console.log(value);<br>}<br>// Outputs:<br>// 1<br>// 2<br>// 3<br>// 4<br>// 5<br><br>// Converting Set to an Array<br>const myArray = [...mySet];<br>console.log(myArray); // Outputs: [1, 2, 3, 4, 5]</pre><h3>When to Use Map and Set</h3><h4>Use Map when:</h4><ul><li>You need a collection of key-value pairs.</li><li>You require keys that are not strings or symbols.</li><li>You need to maintain the order of entries.</li></ul><h4>Use Set when:</h4><ul><li>You need a collection of unique values.</li><li>You want to efficiently check for the existence of a value.</li><li>You need to eliminate duplicates from an array.</li></ul><h3>The Map and Set objects are powerful additions to JavaScript’s standard library, offering more efficient and flexible ways to manage collections of data.</h3><blockquote>“If you believe it, you can achieve it</blockquote><blockquote>The only limit to your success is your imagination”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KZzA_Lc6_v7whk3jtNCTZw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=621d375929e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI has Taken My Job… Up a Notch]]></title>
            <link>https://medium.com/@osotaayomikun/ai-has-taken-my-job-up-a-notch-ea40085a070a?source=rss-5a0a1f258247------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea40085a070a</guid>
            <dc:creator><![CDATA[ayo osota]]></dc:creator>
            <pubDate>Tue, 13 Aug 2024 15:12:49 GMT</pubDate>
            <atom:updated>2024-08-13T15:12:49.347Z</atom:updated>
            <content:encoded><![CDATA[<p>While some fear that AI might replace human jobs, my experience has shown me that AI can elevate our work to unprecedented heights.</p><p>When AI started making waves worldwide, I was skeptical. Like many of us, I wondered if it was just another buzzword. Could AI truly understand and perform the complex tasks we handle as software engineers? Would it make our roles redundant, or would it augment our capabilities?</p><p>The more I learned, the more I realized that AI was not a threat but a powerful tool that could improve the way we work. Tasks like code reviews, bug detection, and even some aspects of coding itself have become more efficient with AI. I now have more time for more creative and strategic work.</p><p>Looking ahead, the integration of AI in software engineering is only set to deepen. With advancements in natural language processing, AI will get better at understanding and predicting our needs. This symbiotic relationship between human and AI promises to unlock new horizons in software development and other fields.</p><p><strong>I encourage you to start embracing AI and explore its potential, it won’t take your job (for now😂). It can however, help you unlock new opportunities, enhance your efficiency, improve your skills, and achieve more than you ever thought possible. AI isn’t just a tool; it’s my partner ❤.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*D3b_q2Mv8Itv1bwcQdYe0g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea40085a070a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Drawing Awesome Shapes with Elliptical Border Radius in CSS]]></title>
            <link>https://medium.com/@osotaayomikun/drawing-awesome-shapes-with-elliptical-border-radius-in-css-d6fea91f47df?source=rss-5a0a1f258247------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6fea91f47df</guid>
            <category><![CDATA[border-radius]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[elliptical]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[ayo osota]]></dc:creator>
            <pubDate>Sat, 10 Aug 2024 03:43:51 GMT</pubDate>
            <atom:updated>2024-08-10T03:43:51.977Z</atom:updated>
            <content:encoded><![CDATA[<p>Most are familiar with the basic usage of border-radius to create circular or rounded shapes but many are unaware of its potential for creating more complex and interesting shapes using elliptical border-radius.</p><h3>Understanding Border-Radius</h3><p>By setting a uniform value, you can achieve simple rounded corners or circles.</p><pre>&lt;!-- Simple rounded corners --&gt;<br>.circle {<br>    width: 100px;<br>    height: 100px;<br>    background-color: #3498db;<br>    border-radius: 50%; /* Creates a circle */<br>}</pre><h3>Elliptical Border-Radius</h3><p>To create an elliptical border-radius, you can use two values separated by a slash (/):</p><pre>.elliptical {<br>    width: 200px;<br>    height: 100px;<br>    background-color: #e74c3c;<br>    border-radius: 50% / 25%;<br>}</pre><h3>Examples</h3><h4>By adjusting the values of the elliptical border-radius, you can create a variety of unique shapes. Here are a few examples:</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fayo_osota%2Fembed%2Fpreview%2FxxoqVWe%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DxxoqVWe&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fayo_osota%2Fpen%2FxxoqVWe&amp;image=https%3A%2F%2Fshots.codepen.io%2Fusername%2Fpen%2FxxoqVWe-512.jpg%3Fversion%3D1722466758&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/d14f1f8780934f55f56311756f2efec1/href">https://medium.com/media/d14f1f8780934f55f56311756f2efec1/href</a></iframe><blockquote>If you can believe it, you can achieve it</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6fea91f47df" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>