<?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: mrCount</title>
    <description>The latest articles on DEV Community by mrCount (@mrcount).</description>
    <link>https://dev.to/mrcount</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%2F296871%2Ffbd5c87d-793f-4e06-b5c8-efcc6a343aa7.jpg</url>
      <title>DEV Community: mrCount</title>
      <link>https://dev.to/mrcount</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mrcount"/>
    <language>en</language>
    <item>
      <title>Ternary Operator</title>
      <dc:creator>mrCount</dc:creator>
      <pubDate>Wed, 25 Mar 2020 15:22:43 +0000</pubDate>
      <link>https://dev.to/mrcount/ternary-operator-4oj5</link>
      <guid>https://dev.to/mrcount/ternary-operator-4oj5</guid>
      <description>&lt;p&gt;Came across it when traversing the sea of JS. I don't know why, but it looks so elegant. And I like it so much I've decided to write about it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;tl:dr version: Basically it's a substitute for the "if" statement.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The premise
&lt;/h3&gt;

&lt;p&gt;The passage bellow is a straight copy from the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator"&gt;MDN&lt;/a&gt; website. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:), and finally the expression to execute if the condition is falsy. This operator is frequently used as a shortcut for the if statement.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This means, you can write an entire "if" statement using just ":" and "?".&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Let's say we're asking a user to input his name with prompt, and then we would like to print out his name with a "greeting". If the user doesn't input anything, we will assign a default value. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;if statement&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Gief me your name!!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userGreeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; waddles around like recieving a prostate exam&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userNameDefault&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Yo'momma&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userNameDefault&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;userGreeting&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;userGreeting&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;ternary operator&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Gief me your name!!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userGreeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; waddles around like recieving a prostate exam&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;
    &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Yo'daddy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;userGreeting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;userGreeting&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;ternary operator with template literal&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Gief me your name!!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userGreeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userName&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; waddles around like recieving a prostate exam`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;
    &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Yo'daddy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userGreeting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userGreeting&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;What the MDN files don't mention if you have more expressions to execute. You can simply chain them together with '+'. &lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;As you see, the code is shorter and looks a little easier to read once you've got used to it. &lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>beginners</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What now?!</title>
      <dc:creator>mrCount</dc:creator>
      <pubDate>Fri, 27 Dec 2019 13:44:20 +0000</pubDate>
      <link>https://dev.to/mrcount/what-now-4nkl</link>
      <guid>https://dev.to/mrcount/what-now-4nkl</guid>
      <description>&lt;p&gt;Well, i've just finished a bootcamp on-line. While my understanding of the curriculum was better than i've expected. I'm somehow at a loss as how to implement everything what i've learned. &lt;br&gt;
Tried some easy projects to do completely on my own and most of the time drew a blank on where to begin. And since i have really high expectations of myself, this is not.. was not acceptable. &lt;/p&gt;

&lt;h2&gt;So, what am I going to do now..&lt;/h2&gt;

&lt;p&gt;Well one of the 1st things I had to get into that stubborn head of mine was, that I've just picked up on a bunch of new knowledge.. and I mean A BUNCH! While doing the full course in about 35 days. I can't expect from myself to just remember everything in the 1st go. &lt;br&gt;
I took a few days off, done some article reading I've saved during that period. Afterwards I visualised and wrote down my plans on where to head from here. &lt;/p&gt;

&lt;p&gt;And the main thing I have to keep in mind.. remember, You have just begun!  &lt;/p&gt;

&lt;h2&gt;The enveloping darkness&lt;/h2&gt;

&lt;p&gt;I think it's important to keep reminding yourself to be patient. As it is a virtue we're not acustomed to anymore. But this has been my problem since my younger days. Always trying to reach for the stars. &lt;br&gt;
Or better yet, having the problem of seeing the bigger picture. This entails the awareness on how much I lack, instead of what I have learned and just continue on from there.&lt;/p&gt;

&lt;p&gt;With that said I have this saying in mind when noticing where my mind is taking me. It helped me get through the workouts when I did competative sports and I think it applies here.&lt;/p&gt;

&lt;p&gt;&lt;i&gt;The journey of a thousand miles begins with a single step&lt;/i&gt;&lt;/p&gt;

&lt;h2&gt;GO!, GO!, POWER RANGERS!!&lt;/h2&gt;

&lt;p&gt;So after reading and ploting my voyage through the oceans of WebDev I noticed many articles write about keeping a journal of your voyage. &lt;/p&gt;

&lt;p&gt;I think the single hardest thing for me is writing my journey down.. I'm just not that guy. Most people have gone through the same things, so what do I have to contribute? &lt;br&gt;
After a few days of deliberation, just got to the undertanding that the question itself is moot. And doing something which isn't comfortable, usually helps you grow as a person.&lt;/p&gt;

&lt;p&gt;So basically everything I do is an investment in me. And this serves as a tool for that. Learning via explanation. It's the same in sports. &lt;br&gt;
If you're aware of correct movement patterns, you will stick by them more thoroughly. And after a while, it just becomes second nature. &lt;/p&gt;

&lt;p&gt;Greatness is a practice, not a status. &lt;i&gt;- lol, sports sure do have a plethora of awesome quotes, don't they&lt;/i&gt; &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
