<?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: stuartBate</title>
    <description>The latest articles on DEV Community by stuartBate (@stuartbate).</description>
    <link>https://dev.to/stuartbate</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%2F1181770%2Fc37690ea-0006-4913-aa4e-18103f11abd6.png</url>
      <title>DEV Community: stuartBate</title>
      <link>https://dev.to/stuartbate</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stuartbate"/>
    <language>en</language>
    <item>
      <title>Point that function somewhere else</title>
      <dc:creator>stuartBate</dc:creator>
      <pubDate>Tue, 10 Oct 2023 23:44:33 +0000</pubDate>
      <link>https://dev.to/stuartbate/point-that-function-somewhere-else-4o01</link>
      <guid>https://dev.to/stuartbate/point-that-function-somewhere-else-4o01</guid>
      <description>&lt;p&gt;Flatiron SE Day 1 pt. 4&lt;/p&gt;

&lt;p&gt;This one is all about arrow functions. &lt;/p&gt;

&lt;p&gt;Brought in with the sweeping ES6 changes, arrow functions have become by new favorite thing. &lt;/p&gt;

&lt;p&gt;Arrow functions allow you to significantly decrease the amount of space simple functions take. They have a few extra limitations beyond a standard function but can really simplify your code. &lt;/p&gt;

&lt;p&gt;I have my coffee ready so let's get into today's lab!&lt;/p&gt;

&lt;p&gt;Here are the parameters for passing the tests:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;has a function expression called divide&lt;/li&gt;
&lt;li&gt;divide divides 2000 by 100&lt;/li&gt;
&lt;li&gt;has an arrow function called square&lt;/li&gt;
&lt;li&gt;square arrow function takes one parameter and multiplies it times itself&lt;/li&gt;
&lt;li&gt;has an arrow function called add&lt;/li&gt;
&lt;li&gt;add arrow function takes two parameters and adds them together&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is how I solved it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//basic function expression for divide

const divide = function(){
    return 2000 / 100
}

// arrow function 
const square = num =&amp;gt; num*num;

// arrow function with 2 arguments
const add = (num1, num2) =&amp;gt; num1+num2;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I absolutely love the simplicity this offers.&lt;/p&gt;

&lt;p&gt;This was pretty straightforward lab which was a lovely break from the last one that may have claimed a small piece of my soul. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Function episode 2 The Function strikes back</title>
      <dc:creator>stuartBate</dc:creator>
      <pubDate>Tue, 10 Oct 2023 22:59:07 +0000</pubDate>
      <link>https://dev.to/stuartbate/function-episode-2-the-function-strikes-back-2j9i</link>
      <guid>https://dev.to/stuartbate/function-episode-2-the-function-strikes-back-2j9i</guid>
      <description>&lt;p&gt;Flatiron SE Day 1 pt 2&lt;/p&gt;

&lt;p&gt;Time to break into the second lab function lab. I have my extra large coffee so lets get into it!&lt;/p&gt;

&lt;p&gt;This lab is all about hoisting, anonymous functions, scope, closure, and immediately-invoked function expressions.&lt;/p&gt;

&lt;p&gt;Here is how I solved it:&lt;/p&gt;

&lt;p&gt;/*this sets an activity for Saturday as the default if no other argument is passed in */&lt;/p&gt;

&lt;p&gt;function saturdayFun(activity = "roller-skate"){&lt;br&gt;
    return &lt;code&gt;This Saturday, I want to ${activity}!&lt;/code&gt;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;/*function expression for Monday with a Default that can be overridden */&lt;br&gt;
let mondayWork = function(activity="go to the office"){&lt;br&gt;
    return &lt;code&gt;This Monday, I will ${activity}.&lt;/code&gt;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;/* create a function expression wrapAdjective&lt;br&gt;
 when initialized with '&lt;em&gt;' creates a function that, when called, wraps an adjective in a highlight&lt;br&gt;
  when initialized with '||' creates a function that, when called, wraps an adjective in a highlight:&lt;br&gt;
  */&lt;br&gt;
 let wrapAdjective = function(style = "&lt;/em&gt;"){&lt;br&gt;
    return function(adjective="neat") {&lt;br&gt;
        return &lt;code&gt;You are ${style}${adjective}${style}!&lt;/code&gt;&lt;br&gt;
    }&lt;br&gt;
 }&lt;/p&gt;

&lt;p&gt;I'm going to need to spend more time studying this one. The Wrap adjective function took lots of google searches and I still do not feel confident in being able to replicate this in any real world setting.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>I'll see you after the Function.</title>
      <dc:creator>stuartBate</dc:creator>
      <pubDate>Tue, 10 Oct 2023 22:09:53 +0000</pubDate>
      <link>https://dev.to/stuartbate/ill-see-you-after-the-function-4j35</link>
      <guid>https://dev.to/stuartbate/ill-see-you-after-the-function-4j35</guid>
      <description>&lt;p&gt;Day 1 Part 2&lt;br&gt;
Took a lovely lunch break after the first quiz in the Flatiron SE program and now it's time to dive into Functions! &lt;/p&gt;

&lt;p&gt;After a great lecture on some of the basics on functions and hoisting it is time for the first lab. The run down was to build 4 function to help small shipping company calculate distances from HQ and the destination based on city blocks. HQ was Positioned on 42 steet and each block was set at 264 feet. I guess this city on has one road running north to south. Here is Below you can see how I solved this&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;```const hq = 42;&lt;/p&gt;

&lt;p&gt;function distanceFromHqInBlocks(street){&lt;br&gt;
    return Math.abs(hq - street);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;function distanceFromHqInFeet(street){&lt;br&gt;
    return Math.abs(hq - street) * 264;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;function distanceTravelledInFeet(start, destination){&lt;br&gt;
    return Math.abs(start - destination) * 264;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;function calculatesFarePrice(start, destination){&lt;br&gt;
    const distance = distanceTravelledInFeet(start, destination);&lt;br&gt;
    if (distance &amp;lt; 400){&lt;br&gt;
        return 0&lt;br&gt;
    }else if (distance&amp;gt;= 400 &amp;amp;&amp;amp; distance&amp;lt; 2000 ){&lt;br&gt;
        return .02 * (distance - 400);&lt;br&gt;
    }else if (distance &amp;gt;= 2000 &amp;amp;&amp;amp; distance &amp;lt; 2500){&lt;br&gt;
        return 25&lt;br&gt;
    }else{&lt;br&gt;
        return &lt;code&gt;cannot travel that far&lt;/code&gt;;&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Obviously there are a few different ways to solve this but using Math.abs really helps minimize the lines of code needed for each function.

Reading this in Blog form has made me realize that I need to be better about commenting in my code so it is easier to understand. 

Thanks for joining me! See you next time!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Today is day one...</title>
      <dc:creator>stuartBate</dc:creator>
      <pubDate>Tue, 10 Oct 2023 21:24:07 +0000</pubDate>
      <link>https://dev.to/stuartbate/today-is-day-one-la7</link>
      <guid>https://dev.to/stuartbate/today-is-day-one-la7</guid>
      <description>&lt;p&gt;My class with Flatiron school started today. I'm excited to see where this leads me, but absolutely intimidated by the things I don't know I don't know. &lt;/p&gt;

&lt;p&gt;The first few lessons are all review on basic JavaScript fundamentals and shouldn't give me too much struggle but I'm sure now that is have said that I will regret it. I know anything involving objects is going to give me a permanent eye twitch. That has been my biggest problem area so far, but I guess growth is pain.&lt;/p&gt;

&lt;p&gt;Here is what I worked on today!&lt;/p&gt;

&lt;p&gt;I started out with a brief video which reviewed basic data types found in JavaScript, and how assignment differs between Let and Const. I also learned that you can enter into the Node.js repl on a local machine by typing "node". Cool. &lt;/p&gt;

&lt;p&gt;The Next lesson was more information on differences between let, Var, and const along with links to the major changes made by ES6. While this was mostly review, I did find it really interesting. Programing languages are not static and sometimes go through major changes to meet the needs of developers. The addition of let and const instead of var seem sweeping and I wonder at the implications to the real-world setting. How often do developers encounter legacy code that still relies of var? How much of their obj is updating existing code to new ES6 syntax.&lt;/p&gt;

&lt;p&gt;After that I moved on to the next lesson on strings and how they can be manipulated. While I worked on the lab for this lesson, I hit an error where I could not get interpolation to work in my environment. It took me longer than I want to admit to remember that ' must be changed to ` for it to work properly. The devil is in the details, and this is a great reminder to me that even though this section is review, I still have a long way to go before it becomes second nature.&lt;/p&gt;

&lt;p&gt;Next, I worked through the lab for control flow, I have always really enjoyed these. Something about these types of problems is very satisfying to solve.&lt;/p&gt;

&lt;p&gt;After that came the arithmetic lab. Initially I was trying to solve the lab by building functions. It took a few attempts to realize that the test wanted literal expression of the equations not a function that would solve them. &lt;/p&gt;

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