<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joel Okoro</title>
    <description>The latest articles on DEV Community by Joel Okoro (@joelokoro).</description>
    <link>https://dev.to/joelokoro</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F207520%2Fbebe3d4e-800d-4c3c-953d-a88ab70c195f.jpg</url>
      <title>DEV Community: Joel Okoro</title>
      <link>https://dev.to/joelokoro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joelokoro"/>
    <language>en</language>
    <item>
      <title>Codewars Challenge: Opposite Number</title>
      <dc:creator>Joel Okoro</dc:creator>
      <pubDate>Wed, 19 Feb 2020 18:45:58 +0000</pubDate>
      <link>https://dev.to/joelokoro/codewars-challenge-opposite-number-approach-20m3</link>
      <guid>https://dev.to/joelokoro/codewars-challenge-opposite-number-approach-20m3</guid>
      <description>&lt;p&gt;This is my approach to the &lt;em&gt;8kyu&lt;/em&gt; challenge labelled &lt;em&gt;Opposite Number&lt;/em&gt;. This will be an explanation on how I approached the challenge and came to a solution.&lt;/p&gt;

&lt;p&gt;The instructions for this challenge were &lt;strong&gt;given a number, find it's opposite&lt;/strong&gt;. For example, &lt;em&gt;4&lt;/em&gt; would return &lt;em&gt;-4&lt;/em&gt; , &lt;em&gt;88&lt;/em&gt; would return &lt;em&gt;-88&lt;/em&gt; and &lt;em&gt;200.38&lt;/em&gt; would return &lt;em&gt;-200.38&lt;/em&gt;. The challenge provides the user a function called opposite which takes in a &lt;em&gt;number&lt;/em&gt; parameter, as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function opposite(number){
/// your code here
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Initial Approach
&lt;/h2&gt;

&lt;p&gt;I first started by thinking of how I could turn the number that would be passed as an argument into a negative number or &lt;em&gt;an opposite of itself&lt;/em&gt;. My initial attempt was to append the string "-" (minus sign) to &lt;em&gt;number&lt;/em&gt; and then return it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function opposite(number){
let newNum = "-" + number;
let oppNum = parseInt(newNum)
return oppNum;
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The code snippet above had a few problems. One issue was that because of the use of the &lt;em&gt;parseInt()&lt;/em&gt; method, decimals or &lt;em&gt;floats&lt;/em&gt; would be rounded to the nearest integer e.g. 4.21 would be -4, instead of -4.21. &lt;/p&gt;

&lt;h2&gt;
  
  
  Final approach &amp;amp; solution
&lt;/h2&gt;

&lt;p&gt;I then realised that I had to think of a way to get the opposite of &lt;em&gt;number&lt;/em&gt; without appending any strings or special characters. I knew that in order to get the negative of the number, it would involve subtracting from &lt;em&gt;number&lt;/em&gt; from another integer or vice versa. The only integer that would remain constant without changing itself or the argument, as well as guaranteeing that a negative number would be returned regardless of being an integer &lt;strong&gt;or&lt;/strong&gt; float, was 0.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function opposite(number){
let oppNum = 0 - number
return oppNum;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>tutorial</category>
      <category>javascript</category>
      <category>challenge</category>
    </item>
    <item>
      <title>Resuming an old project</title>
      <dc:creator>Joel Okoro</dc:creator>
      <pubDate>Tue, 06 Aug 2019 21:49:58 +0000</pubDate>
      <link>https://dev.to/joelokoro/resuming-an-old-project-2d61</link>
      <guid>https://dev.to/joelokoro/resuming-an-old-project-2d61</guid>
      <description>&lt;p&gt;So it turns out that getting back to a project you haven't touched in weeks, gives you a feeling that is eerily similar to the one you get when you load up the save file for a game you haven't played in months  or a TV Series you haven't been keeping up with, only to be reminded how much you've forgotten the controls and that so-and-so character is now the villain.&lt;/p&gt;

&lt;p&gt;The project in question was a website with statistics on top performing players in the Top 2 tiers of English Football (Premier League and Championship). The technologies used were HTML, CSS, SASS, JavaScript and Photoshop.  &lt;/p&gt;

&lt;p&gt;At the time of creating the project, I wanted to practice using NPM and SASS for a project and combining it with my love of football, and felt this would be a perfect way to do that. Anyway, as with most projects, I left it on the backburner  to start a completely new project. Basically, every day I wasn't completing this project, I felt a sort of guilt and regret as well as feeling that the skills I gained learning NPM and SASS were slowing fading away.&lt;/p&gt;

&lt;p&gt;So, how did I overcome this? Well, I carried on with the project as if I never left. I know, it's such an underwhelming answer. But the reason is, every time I thought to myself that I spent too much time away from the project to remember how to write mixins in SASS or that whether or not I should carry on with a brand new project, I wasted even more time. This led me to spend days re-learning things like built-in SASS functions and NPM Scripts just to make sure I remembered each concept for when I resumed the project. &lt;/p&gt;

&lt;p&gt;I feel like it's actually a lot more beneficial to dive back into the project as the concepts actually came back to me whilst I was coding, in addition to re-reading the code I wrote when I last did the project. I also found it super helpful to reference the official documentation.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
