<?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 Stephen Avino on Medium]]></title>
        <description><![CDATA[Stories by Stephen Avino on Medium]]></description>
        <link>https://medium.com/@stephen.avino?source=rss-f541de4e6a2e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*F56hw9nPXUImkzFL-vad5Q.png</url>
            <title>Stories by Stephen Avino on Medium</title>
            <link>https://medium.com/@stephen.avino?source=rss-f541de4e6a2e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:06:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stephen.avino/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[Find the “Mini-Max Sum” Using JavaScript]]></title>
            <link>https://javascript.plainenglish.io/mini-max-sum-javascript-f3a58abae7d0?source=rss-f541de4e6a2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3a58abae7d0</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[hackerrank]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[arrays]]></category>
            <dc:creator><![CDATA[Stephen Avino]]></dc:creator>
            <pubDate>Mon, 14 Feb 2022 14:39:01 GMT</pubDate>
            <atom:updated>2022-02-23T04:36:15.322Z</atom:updated>
            <content:encoded><![CDATA[<h4>A guide on solving the HackerRank coding challenge of finding the “mini-max sum” of given integers.</h4><p>As I stated in my last blog, I have recently been studying up data structures and algorithms, and have been utilizing HackerRank.coms coding challenges. The focus of this blog is going to be walking through their “mini-max sum” challenge, as part of Day 1 in their 1-week interview preparation kit. The question appears as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WV8AAh3LQxjeqPFdBODlUg.png" /></figure><p>So essentially, the challenge here is to print out two different integers separated by a space, the first being the sum of the smallest integers in the given array, and the second being the sum of the largest. In each case, the array given will have 5 integers, and the sums are supposed to use 4 of the 5 for the calculations. The first step is to sort the array:</p><pre><strong>function</strong> miniMaxSum(arr) {</pre><pre><strong>let</strong> sortedArray = arr.sort((a, b) =&gt; a-b);</pre><pre>}</pre><p>Now the array is ordered from the lowest integer to the highest. Moving on, the next step is to write the logic to sum the minimum:</p><pre><strong>function</strong> miniMaxSum(arr) {</pre><pre><strong>let</strong> sortedArray = arr.sort((a, b) =&gt; a-b);</pre><pre><strong>let</strong> minimum = sortedArray.slice(0, sortedArray.length -1).reduce((a, b) =&gt; a+b)</pre><pre>}</pre><p>By calling the slice function on sortedArray with the supplied parameters, the integers to be passed into the reduce function are all integers in the array besides the final integer. Note this could also be completed by hard coding sortedArray[0] + sortedArray[1]…etc. since there will always be 5 integers in the array, but using slice and reducing the code is more dynamic and would function correctly for a larger array. Now for the maximum:</p><pre><strong>function</strong> miniMaxSum(arr) {</pre><pre><strong>let</strong> sortedArray = arr.sort((a, b) =&gt; a-b);</pre><pre><strong>let</strong> minimum = sortedArray.slice(0, sortedArray.length -1).reduce((a, b) =&gt; a+b);</pre><pre><strong>let</strong> maximum = sortedArray.slice(1).reduce((a, b) =&gt; a+b);</pre><pre>}</pre><p>Now that the desired function has been achieved, the final step is to print the output of the min and max in the format being asked, which is the min followed by the max, separated by a space.</p><pre><strong>function</strong> miniMaxSum(arr) {</pre><pre><strong>let</strong> sortedArray = arr.sort((a, b) =&gt; a-b);</pre><pre><strong>let</strong> minimum = sortedArray.slice(0, sortedArray.length -1).reduce((a, b) =&gt; a+b);</pre><pre><strong>let</strong> maximum = sortedArray.slice(1).reduce((a, b) =&gt; a+b);</pre><pre>console.log(minimum, maximum)</pre><pre>}</pre><p>Success! The code passed all given test cases. Luckily JavaScript makes this kind of functionality pretty easy to implement. I hope this was helpful, and as usual, if your code is different than mine feels free to reply in the comments with it.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a><em>. Sign up for our</em><strong><em> </em></strong><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Get exclusive access to writing opportunities and advice in our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3a58abae7d0" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/mini-max-sum-javascript-f3a58abae7d0">Find the “Mini-Max Sum” Using JavaScript</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use the Counting Sort Algorithm in JavaScript]]></title>
            <link>https://javascript.plainenglish.io/using-the-counting-sort-algorithm-javascript-94423623b1a5?source=rss-f541de4e6a2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/94423623b1a5</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[counting-sort]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Stephen Avino]]></dc:creator>
            <pubDate>Mon, 14 Feb 2022 04:27:35 GMT</pubDate>
            <atom:updated>2022-02-15T04:29:49.958Z</atom:updated>
            <content:encoded><![CDATA[<h4>A guide on how to use the Counting Sort Algorithm in JavaScript</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qc_eWO3CqOxwP_3r" /><figcaption>Photo by <a href="https://unsplash.com/@mitchel3uo?utm_source=medium&amp;utm_medium=referral">Mitchell Luo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As my time as a software engineering student at Flatiron School comes to a close, I have been doing daily challenges on HackerRank.com as preparation for future interviews. The focus of this article is going to be on tackling the HackerRank question “Counting Sort 1.” The question looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whlh4SY70nSW8fNESHjsqg.png" /></figure><p>Essentially, the function to be created must accept an array as its parameter, and return a frequency array with the values at each index associated with the frequency the value occurred in the original array. The first step in doing so is to create a new array with the same amount of indices as the array being passed into the function.</p><pre><strong>function</strong> countingSort(arr) {</pre><pre><strong>let</strong> frequencyArray = <strong>new</strong> Array(100).fill(0);</pre><pre>}</pre><p>Simple enough. Note that the “fill” must be included otherwise the values at each of the indices remain undefined, and the array would remain empty. The next step is to iterate over the original array that the function is accepting (arr), and increment the number at the associated index of frequencyArray by 1. This can be done using a for loop:</p><pre><strong>function</strong> countingSort(arr) {</pre><pre><strong>let</strong> frequencyArray = <strong>new</strong> Array(100).fill(0);</pre><pre><strong>for</strong>(<strong>let</strong> num <strong>of</strong> arr){</pre><pre>frequencyArray[num]++;</pre><pre>}<br>}</pre><p>Finally, once the loop is completed and the frequencyArray contains the correct counts, the last step is to return frequencyArray.</p><pre><strong>function</strong> countingSort(arr) {</pre><pre><strong>let</strong> frequencyArray = <strong>new</strong> Array(100).fill(0);</pre><pre><strong>for</strong>(<strong>let</strong> num <strong>of</strong> arr){</pre><pre>frequencyArray[num]++</pre><pre>}</pre><pre><strong>return</strong> frequencyArray;</pre><pre>}</pre><p>And that’s it! Not too difficult for this one. I’d love to see how others solved this, so if you came up with a different solution than mine drop it in the comments. Be sure to follow me and keep an eye out for future HackerRank challenge walkthroughs.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Get exclusive access to writing opportunities and advice in our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94423623b1a5" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/using-the-counting-sort-algorithm-javascript-94423623b1a5">How to Use the Counting Sort Algorithm in JavaScript</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a Simple Dark Mode Toggle for Your React Application with Material-UI]]></title>
            <link>https://javascript.plainenglish.io/how-to-create-a-simple-dark-mode-toggle-for-your-react-application-with-material-ui-108dcfded095?source=rss-f541de4e6a2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/108dcfded095</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Stephen Avino]]></dc:creator>
            <pubDate>Sun, 23 Jan 2022 21:29:21 GMT</pubDate>
            <atom:updated>2022-02-15T04:32:50.617Z</atom:updated>
            <content:encoded><![CDATA[<h4>A guide on creating a simple dark mode toggle for your React app using Material-UI.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*vR-c2OlaAJLjK9ue5785rA.gif" /></figure><p>It seems like nowadays every website has a dark mode feature. Not only is it aesthetically pleasing to have a sleek dark UI, but dark mode enthusiasts also promote a range of other benefits from reduced eye strain and less battery usage to improved reading comprehension for users. The focus of this article will be designing a very simple dark mode toggle using <a href="https://mui.com/">material UI</a>.</p><p>For the purposes of this tutorial, I’ve created a very basic application with just two card components showing with, of course, dogs on them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-AYQJt369SIQmUwGbXZbXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G0fO1QpnCouaQvCZEIkomA.png" /></figure><p>The first step is to install the npm packages for material UI which can be done using:</p><pre>npm install <a href="http://twitter.com/mui/material">@mui/material</a> <a href="http://twitter.com/emotion/react">@emotion/react</a> <a href="http://twitter.com/emotion/styled">@emotion/styled</a></pre><p>Once it has finished defining the following imports directly into the App.js file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*5RRBbS_tE1DLg4qHl-WJKw.png" /></figure><p>ThemeProvider is a material UI component that allows us to wrap the entire application with the new theme, which will be accomplished using the createTheme function. Here I am also importing the useState hook to create the toggle aspect.</p><p>The next step is to create the theme that will display on our page which in this case is dark mode. createTheme takes in a value of an object and has a number of different properties that can be defined here in addition to color, but conveniently the developers added the ability to include dark mode just by setting the mode key nested inside the “palette” object to “dark.” Additionally, as seen below, I have created a state called darkMode and set it to false.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*EquVGzLKaOChl9hE38fr_g.png" /></figure><p>Ultimately what is happening above, is that the theme constant is set to a created theme, with the mode set to “dark” if our dark mode state is true and “light” if it is false.</p><p>Next, we need to wrap the components in the ThemeProvider component. However, themes can not be applied directly to React components, they must be applied to a material UI component, so for our purposes, we’ll use Paper. Add the Paper import and wrap the return with these components. Add the theme state created earlier as the theme prop inside the ThemeProvider component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*6c7m_zhNxm8o2KB134nWEQ.png" /></figure><p>The last step is to just add our button, and have that button call the setDarkMode function created earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*1CW6HcaIMTEkVesJdYDraA.png" /></figure><p>Add some text to the button to make it identifiable, click it, and…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YLdKdx8iIOJ2ZGjDrX4-FA.png" /></figure><p>Your page now has dark mode! However, the button is kind of ugly. Let’s make it a little nicer using material UI. Install the material UI icons pack by running the command:</p><pre>npm i @mui/icons-material</pre><p>Add imports for any icons that pique your interest, I like to use Brightness7 and Brightness4. You’ll also need to import the IconButton component from material UI. Create a ternary expression that determines which component is displayed, and replace the button created earlier with the IconButton component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S2EEm9mnpy9NoLHViRvJwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WEZvlOia5L_IEXjPCPWITw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VMq9P33seiCzJGCl2cDfSQ.png" /></figure><p>And with that, you now have a button that changes icons depending on which mode the theme is set to. If you like how this process works, I highly recommend taking a look through material UI’s documentation to see other ways you can change the theme for your applications, as well as other useful components in their library.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Get exclusive access to writing opportunities and advice in our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=108dcfded095" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-create-a-simple-dark-mode-toggle-for-your-react-application-with-material-ui-108dcfded095">How to Create a Simple Dark Mode Toggle for Your React Application with Material-UI</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Moment it Clicked — A Student’s Tale of Learning JavaScript]]></title>
            <link>https://javascript.plainenglish.io/the-moment-it-clicked-a-students-tale-of-learning-javascript-b51a5dfccb4d?source=rss-f541de4e6a2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b51a5dfccb4d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Stephen Avino]]></dc:creator>
            <pubDate>Mon, 22 Nov 2021 17:26:03 GMT</pubDate>
            <atom:updated>2022-02-17T00:38:57.291Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Moment it Clicked — A Student’s Tale of Learning JavaScript</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SQ5lK5QXAH_8npF4" /><figcaption>Photo by <a href="https://unsplash.com/@juanjodev02?utm_source=medium&amp;utm_medium=referral">Juanjo Jaramillo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Beginning</h3><p>It’s safe to say that in every programmer’s journey into the world of software development, there are numerous hurdles encountered along the way. In my experience, and in the experience of many others, the most daunting of these hurdles appeared early on.</p><p>I can think of no better way to explain this roadblock than by calling it the “what am I looking at” hurdle. Many new programmers find themselves dealing with a severe case of imposter syndrome due to this, as early on in software development, it is quite a normal feeling to look at some code and think to yourself, “I have no idea what I am doing.”</p><h3>Imposter Syndrome?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*IxXnQrD2Tgq6DSf_uyqscQ.jpeg" /><figcaption>Image 1. An extremely confused and frustrated programmer.</figcaption></figure><p>Imposter syndrome — if you’ve heard it before you probably have felt it, if not…you’ve still probably felt it. Basically, imposter syndrome is the feeling that you’re a fraud and don’t have the abilities or skills to complete the tasks in front of you. This concept is crucial to touch on for anyone starting the process of learning to code. Knowing to expect this does not necessarily prevent it from occurring, but being aware that you will most likely encounter imposter syndrome at some point during your programming journey can help you persevere through it, and realize that every developer has felt this way at one point or another.</p><h3>My experience: The moment it clicked</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*X0TRTY4KoENfEcKnwEwzmA.png" /><figcaption>Image 2. Either a simple Javascript fetch function, or the matrix, depending on where you are in your JavaScript journey.</figcaption></figure><p>So when does it finally click? Unfortunately, I can’t answer that. I think that it’s very subjective — some people may have this moment during the first week of coding, for others, it may be after a few months. For myself, it happened during my second week of coding Bootcamp at Flatiron School.</p><p>I had been attempting to understand how to iterate through arrays in JavaScript using a <em>for…of </em>loop, a fairly simple concept once you understand it. However, I just couldn’t make sense of it. “What is happening here? Why does it know what to return? Why the heck am I declaring a variable within the loop?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*Sj2eC7onsr-DxlBdoOik9g.png" /><figcaption>Image 3. The parameters of a for…of loop.</figcaption></figure><h3>Aha!</h3><p>Without getting overly semantical, my “aha!” moment happened when I realized that a for loop is really telling exactly what it is going to do: for each appearance of the constant defined within the for loop parameters, perform whatever action is defined in the statement following. For me, this moment was less about for loops and iteration, and more about the fact that the thing I had been staring at on my screen for hours, which ultimately caused me to doubt my potential as a developer, had been conquered.</p><p>It is important to realize that everyone learns differently, with different strengths and weaknesses. Software development is no exception to this, and the implications of imposter syndrome can be significant — many leave the field early on thinking “I can’t do this” or “I’m not smart enough.” But the path to understanding is not always straightforward, and though there may be roadblocks in the way, with time and patience any obstacles can be overcome.</p><p><em>More content at </em><a href="http://plainenglish.io/"><strong><em>plainenglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Get exclusive access to writing opportunities and advice in our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b51a5dfccb4d" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/the-moment-it-clicked-a-students-tale-of-learning-javascript-b51a5dfccb4d">The Moment it Clicked — A Student’s Tale of Learning JavaScript</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>