<?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: Allison Cortez</title>
    <description>The latest articles on DEV Community by Allison Cortez (@allisoncortez).</description>
    <link>https://dev.to/allisoncortez</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%2F453830%2F7c6a0886-8064-4e44-83ec-aca30c3c40c2.jpeg</url>
      <title>DEV Community: Allison Cortez</title>
      <link>https://dev.to/allisoncortez</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/allisoncortez"/>
    <language>en</language>
    <item>
      <title>Discovering GraphQL</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Mon, 01 Feb 2021 03:34:43 +0000</pubDate>
      <link>https://dev.to/allisoncortez/discovering-graphql-5cl5</link>
      <guid>https://dev.to/allisoncortez/discovering-graphql-5cl5</guid>
      <description>&lt;p&gt;I recently had the opportunity to play around with GraphQL. It's been a fun experience for sure. I just wanted to list out some resources that have been helpful for me. For those of you who are wanting to explore GraqhQL, I would highly suggest trying it out! I definitely can see the benefits of working with it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://graphql-code-generator.com/docs/getting-started/index"&gt;graphql-code-generator.com&lt;/a&gt;&lt;br&gt;
&lt;a href="https://css-tricks.com/a-complete-walkthrough-of-graphql-apis-with-react-and-faunadb/"&gt;CSS Tricks&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're using GraphQL with React and TypeScript&lt;br&gt;
&lt;a href="https://nainacodes.com/blog/intro-to-graphql-and-react-with-typescript"&gt;nainacodes.com/blog&lt;/a&gt;&lt;br&gt;
&lt;a href="https://hasura.io/learn/graphql/typescript-react-apollo/intro-to-graphql/3-writing-data-mutations/"&gt;hasura.io/learn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What are some of your favorite resources? Feel free to comment below.&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://www.pexels.com/@anniroenkae?utm_content=attributionCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=pexels"&gt;Anni Roenkae&lt;/a&gt; from Pexels&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>codenewbie</category>
      <category>webdev</category>
      <category>react</category>
    </item>
    <item>
      <title> What is Function Binding? 💫</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Sun, 24 Jan 2021 15:00:30 +0000</pubDate>
      <link>https://dev.to/allisoncortez/what-is-function-binding-120k</link>
      <guid>https://dev.to/allisoncortez/what-is-function-binding-120k</guid>
      <description>&lt;p&gt;When working with a regular function in JavaScript (not an arrow function), you'll find that when using the &lt;code&gt;this&lt;/code&gt; context, you're referring to the object that invoked the function. &lt;/p&gt;

&lt;p&gt;Sometimes, this ends up creating different results than what you'd expect.&lt;/p&gt;

&lt;p&gt;Take the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;Bob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;temperature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;45 degrees&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;sayNews&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;It is ${this.temperature} outside!&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="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Bob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sayNews&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// It is undefined outside!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll notice that we get &lt;strong&gt;&lt;em&gt;undefined&lt;/em&gt;&lt;/strong&gt; for the &lt;code&gt;temperature&lt;/code&gt; variable. That's because when we refer to &lt;code&gt;this&lt;/code&gt; in our setTimeout call, we are actually referring to the &lt;code&gt;Window Object&lt;/code&gt; itself, and &lt;strong&gt;&lt;em&gt;NOT&lt;/em&gt;&lt;/strong&gt; &lt;code&gt;Bob&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Are you confused yet?&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
So let's break this down.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;setTimeout called on Bob&lt;/li&gt;
&lt;li&gt;Inside Bob, in the sayNews function, &lt;code&gt;this&lt;/code&gt; was referred to.&lt;/li&gt;
&lt;li&gt;Since setTimeout is a &lt;a href="https://www.w3schools.com/jsref/obj_window.asp"&gt;Window Object&lt;/a&gt; method, Javascript thinks that &lt;code&gt;this&lt;/code&gt; is referring to the &lt;code&gt;Window&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;To fix this, we could do one of two things&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Use &lt;code&gt;.bind&lt;/code&gt; to specifically bind an object to a function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Bob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sayNews&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Bob&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// It is 45 degrees outside!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use arrow functions, introduced in &lt;a href="https://www.w3schools.com/Js/js_es6.asp"&gt;ES6&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;Dug&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sayHi&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// It is 45 degrees outside!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope this was helpful. Thanks for reading :)&lt;/p&gt;

&lt;h4&gt;
  
  
  Resources
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions"&gt;MDN, Arrow Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/swlh/javascript-arrow-functions-es6-9f2e0d289826"&gt;Medium article&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Photo by &lt;a href="https://www.pexels.com/@markusspiske?utm_content=attributionCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=pexels"&gt;Markus Spiske&lt;/a&gt; from Pexels&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Newsletters I actually enjoyed in 2020. 👩🏻‍💻🌍💫</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Sun, 17 Jan 2021 17:50:39 +0000</pubDate>
      <link>https://dev.to/allisoncortez/newsletters-i-actually-enjoyed-in-2020-3id6</link>
      <guid>https://dev.to/allisoncortez/newsletters-i-actually-enjoyed-in-2020-3id6</guid>
      <description>&lt;p&gt;Hi Everyone, &lt;br&gt;
Here's a list of newsletters I actually enjoyed in 2020! What's been your favorite newsletter? Feel free to comment down below!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.hackernewsletter.com/"&gt;&lt;strong&gt;Hackernewsletter&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
More of a weekly newsletter, with articles on programming, startups, and current happenings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/explore"&gt;&lt;strong&gt;GitHub explore&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
Catches you up on what's trending. There are different options on how frequently you'd want to receive content.&lt;/p&gt;

&lt;p&gt;P.S. You'll need a Github account in order to sign up for email updates.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://sid.st/blog/"&gt;&lt;strong&gt;Weekly newsletter by Siddharth Kshetrapal&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
A friend recently recommended this newsletter to me, and honestly, I've thoroughly enjoyed Siddarth's content. It's definitely Javascript focused, but he also has other things in there about growth as a developer and other tidbits.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://statuscode.com/"&gt;&lt;strong&gt;Status code newsletters&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
They have a list of different newsletters you can subscribe to. I can only attest to the Javascript and Frontend Focused ones. I think they do a good job of curating an insightful list of resources and tutorials.&lt;/p&gt;

&lt;p&gt;Thanks for reading :)&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>career</category>
      <category>productivity</category>
      <category>news</category>
    </item>
    <item>
      <title>Boost Your Productivity in 2021, get a Notion 😎</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Sun, 10 Jan 2021 13:37:09 +0000</pubDate>
      <link>https://dev.to/allisoncortez/boost-your-productivity-in-2021-get-a-notion-1iic</link>
      <guid>https://dev.to/allisoncortez/boost-your-productivity-in-2021-get-a-notion-1iic</guid>
      <description>&lt;p&gt;I recently discovered the Notion App this week, and it's honestly been the best thing in 2021 so far! For those who don't know what Notion is, here's the Wikipedia definition:&lt;br&gt;
&lt;code&gt;Notion is an application that provides components such as databases, kanban boards, wikis, calendars, and reminders. Users can connect these components to create their own systems for knowledge management, note-taking, data management, project management, among others. These components and systems can be used individually, or in collaboration with others.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/eXnLOTCiLID841VN4a/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/eXnLOTCiLID841VN4a/giphy.gif" alt="that sounds good"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the main things you need to know about Notion:&lt;/p&gt;

&lt;h3&gt;
  
  
  It works like any other text editor.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  It's features are built-in.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can access features easily by starting your line with the following character: &lt;code&gt;/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You'll get access to numerous 'block' options where you will be able to add in tables, calendars, kanboards, you name it, in order to customize your page to your liking.&lt;/li&gt;
&lt;li&gt;ULTIMATE CUSTOMIZATIONNNN&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Start with a Template
&lt;/h3&gt;

&lt;p&gt;My recommendation would be to get started with a template, when you're just learning how to navigate through Notion. Explore options, play around with the interface. Once you're comfortable, start a page of your own or make your own custom template!&lt;/p&gt;

&lt;p&gt;free templates &lt;a href="https://www.notion.so/Bachelor-of-Arts-in-Organization-Fall-2020-02272d62ab204e88817b5ab3f332617f"&gt;here&lt;/a&gt;, &lt;a href="https://www.notion.so/2021-Goals-and-Reflections-Template-282f0ef2c7a146abb37a0fa2153072be"&gt;here&lt;/a&gt; and &lt;a href="https://www.notion.so/twirling-pages-notion-5e98a9e589274f9089db30a16ef58e6d"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also use one of the many build-in templates that come with Notion.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Resources&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Notion's plethora of tutorials on Youtube &lt;a href="https://www.youtube.com/c/Notion/featured"&gt;https://www.youtube.com/c/Notion/featured&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Keep Productive, Beginners Guide to Notion &lt;a href="https://www.keepproductive.com/blog/notion-for-beginners#:%7E:text=What%20is%20Notion?,toolkit%20to%20get%20work%20done"&gt;https://www.keepproductive.com/blog/notion-for-beginners#:~:text=What%20is%20Notion?,toolkit%20to%20get%20work%20done&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;youtube walkthrough &lt;a href="https://www.youtube.com/watch?v=lZ83Vu0SoG0&amp;amp;t=925s"&gt;https://www.youtube.com/watch?v=lZ83Vu0SoG0&amp;amp;t=925s&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>productivity</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Start the Year Strong, Join a Dev Community</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Sat, 02 Jan 2021 20:15:03 +0000</pubDate>
      <link>https://dev.to/allisoncortez/start-the-year-strong-join-a-dev-community-2pdn</link>
      <guid>https://dev.to/allisoncortez/start-the-year-strong-join-a-dev-community-2pdn</guid>
      <description>&lt;p&gt;Getting involved with a community has been essential to my journey as a developer. It's advice I got early on, and something I would like to pass along to others.&lt;/p&gt;

&lt;p&gt;A quick note: I'm a Mexican-American lady, originally from Texas. I would say that the communities I've joined are definitely geared towards my demographic.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/lTecNFkWIEz5kaGbvS/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/lTecNFkWIEz5kaGbvS/giphy.gif" alt="friends"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Getting involved with a community could be daunting at first.
&lt;/h4&gt;

&lt;p&gt;Not sure where to start? &lt;br&gt;
&lt;a href="https://i.giphy.com/media/WzCZU1PbrmfZu/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/WzCZU1PbrmfZu/giphy.gif" alt="eek"&gt;&lt;/a&gt;&lt;br&gt;
Here are some great first action steps:&lt;/p&gt;

&lt;h1&gt;
  
  
  Go to Meetups
&lt;/h1&gt;

&lt;p&gt;This is especially true for our post-pandemic world. Even though it's definitely not the same as in-person, It's a great way to get connected with your local community, or even join some nationwide groups. &lt;/p&gt;

&lt;p&gt;You can learn something new, sign up for lightning talks, join a more non-formal happy hour setting, or attend a traditional workshop. There are so many different types of formats when it comes to Meetup groups, you're bound to find something that sparks your interest.&lt;/p&gt;

&lt;h1&gt;
  
  
  Join a Slack
&lt;/h1&gt;

&lt;p&gt;Similar to Discord, Slack is an online community where you can join specific groups and channels that you're interested in. It's a great way to meet new people and chat in a more direct way with members within your group. Here are a few slacks I've thoroughly enjoyed being apart of: &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://www.womenwhocode.com/"&gt;Women Who Code&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Every experience I've had with these ladies has been a positive one. From their active slack communities to their numerous events, every interaction has been exceptional. The WWC website itself has so many resources. Once you're acquainted with a local chapter or have done some research on their website, I would definitely suggest joining a local chapter, if there is one in your city, or even joining a specialty slack ( They range from Front-end Development to Cloud Development).&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://techqueria.org/"&gt;Techqueria&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Techqueria is one of the most active Slacks I've been apart of. They have great channels to join, everyone is super friendly and resourceful. You can even sign up for their &lt;strong&gt;&lt;em&gt;#cafecito&lt;/em&gt;&lt;/strong&gt; channel which automatically connects you with another member in the slack every 2 weeks, encouraging you to meet other members.  &lt;/p&gt;

&lt;h1&gt;
  
  
  Get Involved: Join Discussions
&lt;/h1&gt;

&lt;p&gt;Now that you've joined a community or are on Meetup learning and meeting local devs, I would be active in that community. There are several ways to do this. You could sign up for a lightning talk in your meetup group, if it's a slack community, stay involved through discussions in the chat groups. See if there are opportunities for volunteer work in your community, or even find an open-source project to contribute to. The list goes on!&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;I hope this gave you a good idea of where to start. As always, feel free to comment below your favorite ways to connect with others. I'll also put some resources down below.&lt;/p&gt;

&lt;h4&gt;
  
  
  Resources
&lt;/h4&gt;

&lt;p&gt;Here are a few resources I've enjoyed this past year.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.diversifytech.co/"&gt;Diversify Tech&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.tldrnewsletter.com/?utm_source=fwd&amp;amp;utm_campaign=fe549346-f855-11ea-a3d0-06b4694bee2a"&gt;TLDR Newsletter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techbychoice.org/"&gt;Tech by Choice Slack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jumpstart.me/communities/home"&gt;Jumpstart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://powertofly.com/"&gt;Power To Fly events&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>career</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Using Map, Filter, and Reduce: Collection-Processing Methods in Javascript </title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Sun, 27 Dec 2020 16:32:15 +0000</pubDate>
      <link>https://dev.to/allisoncortez/using-map-filter-and-reduce-collection-processing-methods-in-javascript-2a5o</link>
      <guid>https://dev.to/allisoncortez/using-map-filter-and-reduce-collection-processing-methods-in-javascript-2a5o</guid>
      <description>&lt;p&gt;filter, map and reduce are very powerful methods. They allow you to iterate through the contents of an array, similar to a for loop. Each method creates a new array, element or object, based on the callback function that it's supplied. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/vCwMOU05OcdQk/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/vCwMOU05OcdQk/giphy.gif" alt="curtsy"&gt;&lt;/a&gt;&lt;br&gt;
I would say these three methods win the popularity contest due to the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;their non-destructive nature&lt;/em&gt;&lt;/strong&gt;(The return value is a copy of the original, the original stays unchanged)&lt;/li&gt;
&lt;li&gt;they are easier to write and follow DRY(Don't Repeat Yourself) principles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's go ahead and break these down: &lt;/p&gt;
&lt;h2&gt;
  
  
  Array.Map()
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;invokes a callback function on every element in the array&lt;/li&gt;
&lt;li&gt;returns a copy of the original array that is passed to it&lt;/li&gt;
&lt;li&gt;the original array does not change
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;newArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;4&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;newArray&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [12, 14, 16, 18]&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;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//[8, 10, 12, 14]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Learn more about map &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map"&gt;here&lt;/a&gt; and &lt;a href="https://www.digitalocean.com/community/tutorials/4-uses-of-javascripts-arraymap-you-should-know"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Array.Filter()
&lt;/h2&gt;

&lt;p&gt;The filter method is very similar to map. It also goes through every element of an array and returns a new updated copy of that array. &lt;strong&gt;&lt;em&gt;The difference lies in how we utilize the callback&lt;/em&gt;&lt;/strong&gt; function. &lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="c1"&gt;// [12, 14]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;strong&gt;&lt;em&gt;the new array here has all the elements that return true&lt;/em&gt;&lt;/strong&gt; for the callback function. All elements that return false will be skipped. If we have no true elements, the return value will be an empty array.&lt;/p&gt;

&lt;h2&gt;
  
  
  Array.Reduce()
&lt;/h2&gt;

&lt;p&gt;The reduce method &lt;strong&gt;&lt;em&gt;applies a function to each value of the array&lt;/em&gt;&lt;/strong&gt; using an accumulator, &lt;strong&gt;&lt;em&gt;reducing it to one single value&lt;/em&gt;&lt;/strong&gt;. Just like map and filter, the original array remains unchanged.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;The reducer function takes four arguments:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accumulator&lt;/li&gt;
&lt;li&gt;Current Value&lt;/li&gt;
&lt;li&gt;Index&lt;/li&gt;
&lt;li&gt;Array (our original)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;MDN Syntax:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;arr.reduce(callback( accumulator, currentValue, [, index[, array]] )[, initialValue])&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3o85xuUoAybzvzsMPS/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3o85xuUoAybzvzsMPS/giphy.gif" alt="reduce"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  More on reduce()
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You can think of the &lt;code&gt;accumulator&lt;/code&gt; as a running total, with each element of our array being added to that total.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;index&lt;/code&gt;, &lt;code&gt;array&lt;/code&gt;, and &lt;code&gt;initialValue&lt;/code&gt; are all optional. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If an &lt;code&gt;initialValue&lt;/code&gt; is not provided, the first element of the array will be the &lt;strong&gt;&lt;em&gt;accumulator&lt;/em&gt;&lt;/strong&gt; and the second element will become the &lt;strong&gt;&lt;em&gt;currentValue&lt;/em&gt;&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;accumulator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;currentValue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;currentIndex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;accumulator&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;currentValue&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;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If an initial value IS provided, the accumulator will be equal to the &lt;code&gt;initialValue&lt;/code&gt;. &lt;code&gt;currentValue&lt;/code&gt; will equal the first element in our array.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;accumulator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;currentValue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;currentIndex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;accumulator&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;currentValue&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;10&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;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 20&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since we provided an initial value of 10, we start with our accumulator at 10, adding each element in the array to 10, giving us a total of 20.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map"&gt;&lt;code&gt;map&lt;/code&gt;&lt;/a&gt;: Transform every element and create a new array&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter"&gt;&lt;code&gt;filter&lt;/code&gt;&lt;/a&gt;: Create a new array with all elements that pass the test implemented by the callback function.&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce"&gt;&lt;code&gt;reduce&lt;/code&gt;&lt;/a&gt;: Reduce every element into a new value&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://www.pexels.com/@mccutcheon?utm_content=attributionCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=pexels"&gt;Sharon McCutcheon&lt;/a&gt; from Pexels&lt;/p&gt;

&lt;p&gt;Thanks for reading! :)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>JS Fundamentals: var, let, and const</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Mon, 21 Dec 2020 02:45:59 +0000</pubDate>
      <link>https://dev.to/allisoncortez/js-fundamentals-var-let-and-const-4198</link>
      <guid>https://dev.to/allisoncortez/js-fundamentals-var-let-and-const-4198</guid>
      <description>&lt;p&gt;Var, let and const are different type of variable declarations. In this article, I'll be doing a quick rundown of the differences between var, let, and const.&lt;/p&gt;

&lt;p&gt;I would say this is more for readers who are just getting started with Javascript or are maybe new to ES6 and its features.&lt;/p&gt;

&lt;p&gt;Things to note, before continuing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SCOPE: where the variables are available for use.&lt;/li&gt;
&lt;li&gt;HOISTING: a JS mechanism where variables and function declarations are moved to the top of their scope before execution. (this is more for variables declared with var)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  VAR
&lt;/h2&gt;

&lt;p&gt;Before ES6, var was the only type of declaration used.&lt;br&gt;
It's best practice to only use var when ABSOLUTELY NECESSARY. Most programmers think var is too editable and presents issues like accidentally overriding code you were trying to keep or introducing security issues due to the global access that &lt;code&gt;var&lt;/code&gt; has.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SCOPE: global/function-based&lt;/li&gt;
&lt;li&gt;HOISTING: hoisted to the top of its scope, initialized with &lt;code&gt;undefined&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;var can be updated&lt;/li&gt;
&lt;li&gt;var can be redeclared&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scope Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;howdy&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// howdy = undefined&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;howdy&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// this would print out undefined&lt;/span&gt;
&lt;span class="nx"&gt;howdy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hi there&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;// howdy value is updated to "hi there"&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;howdy&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// this would print out "hi there"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since howdy is called first without being assigned, howdy gets stored with an undefined variable in the first line. In the second line, our console.log will return undefined. After we assign a value on line 3, our console log will update the howdy variable and assign it to "hi there". So on line 4, our console log will be "hi there".&lt;/p&gt;

&lt;h2&gt;
  
  
  LET
&lt;/h2&gt;

&lt;p&gt;Let is preferred for variable declaration.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SCOPE: block (let would only be available within that block)&lt;/li&gt;
&lt;li&gt;HOISTING: Hoisted to the top, NOT initialized, which means you'll get a &lt;code&gt;Reference Error&lt;/code&gt; if you try to call the variable before it's been declared.&lt;/li&gt;
&lt;li&gt;Let can be updated.&lt;/li&gt;
&lt;li&gt;Let can not be re-declared.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is a block?&lt;/strong&gt;&lt;br&gt;
A block of code closed in with curly braces &lt;code&gt;{}&lt;/code&gt;. Anything inside the curly braces is part of that block.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;blockScope&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;car&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;honda&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;car&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "honda"&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;car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// car is undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since the car variable was declared inside of our block, it has block scope. We do not have access to it outside of the block. So when we console.log on the last line, we will get an error, undefined.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let CAN NOT be re-declared&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// we can re-assign egg's value&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;egg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;over-easy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="nx"&gt;egg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sunny-side up&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//we CAN'T re-declare egg after that first time&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;egg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sunny-side up&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;egg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hard-boiled&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;//error: egg has already been declared&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CONST
&lt;/h2&gt;

&lt;p&gt;Variables declared with const will keep a consistent value, meaning if you assign a string to your egg value, you won't want to change the value to an integer later. The value type stays constant.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SCOPE: block&lt;/li&gt;
&lt;li&gt;HOISTING: Hoisted to the top, but NOT initialized. (like our let variable)&lt;/li&gt;
&lt;li&gt;const can not be updated&lt;/li&gt;
&lt;li&gt;const can not be redeclared&lt;/li&gt;
&lt;li&gt;while var and let can be declared without a value, const MUST be initialized with a value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope this was helpful. Any questions or additions? Please leave a comment. Also, thanks for reading :)&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://www.pexels.com/@apasaric?utm_content=attributionCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=pexels"&gt;Aleksandar Pasaric&lt;/a&gt; from Pexels&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Breaking down a classic interview question: FizzBuzz</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Sun, 13 Dec 2020 21:09:36 +0000</pubDate>
      <link>https://dev.to/allisoncortez/breaking-down-a-classic-interview-question-fizzbuzz-572f</link>
      <guid>https://dev.to/allisoncortez/breaking-down-a-classic-interview-question-fizzbuzz-572f</guid>
      <description>&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;br&gt;
write a program that console logs the numbers from 1 to n.&lt;br&gt;
For multiples of 3 print 'fizz' instead of the number. For multiples of 5 print 'buzz'. For numbers that are multiples of both 3 and 5, print 'fizzbuzz'.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
fizzBuzz(5)&lt;br&gt;
1&lt;br&gt;
2&lt;br&gt;
fizz&lt;br&gt;
4&lt;br&gt;
buzz&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The first thing that popped into my head:&lt;/strong&gt;&lt;br&gt;
We have to iterate through our list of numbers in some way, in order to check each individual number from one to n, which means...&lt;/p&gt;
&lt;h2&gt;
  
  
  STEP 1, A FOR LOOP
&lt;/h2&gt;

&lt;p&gt;We'll assign i to start at one, since this specific problem requires us to do so.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;fizzBuzz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// here, we'll check each number for our requirements..&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;The next thing to think about would be how exactly would you calculate a multiple of a number?&lt;/p&gt;

&lt;p&gt;Here's a helpful link, in case anyone is lost right now:&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder"&gt;MDN Docs&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  STEP 2, THE MODULO OPERATOR
&lt;/h2&gt;

&lt;p&gt;The first check to make would be to see if our current number in the loop is a modulo of both 3 and 5.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;fizzBuzz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//is the number a multiple of 3 and 5?&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;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fizzbuzz&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="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;Sidenote&lt;/strong&gt;&lt;br&gt;
We &lt;strong&gt;DO NOT&lt;/strong&gt; set up another separate if statement... we want to build on that first check.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What this means:&lt;/strong&gt;&lt;br&gt;
If our first if statement is true, we don't run any other code inside the for loop. To ensure this, we'll add onto the first if statement with else ifs.&lt;/p&gt;
&lt;h2&gt;
  
  
  STEP 3
&lt;/h2&gt;

&lt;p&gt;Check to see if we have a multiple of three.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;fizzBuzz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//is the number a multiple of 3 and 5?&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;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fizzbuzz&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="k"&gt;else&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;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// is the number a multiple of 3?&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fizz&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="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  STEP 4
&lt;/h2&gt;

&lt;p&gt;Check to see if we have a multiple of five.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;fizzBuzz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//is the number a multiple of 3 and 5?&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;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fizzbuzz&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="k"&gt;else&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;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// is the number a multiple of 3?&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fizz&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="k"&gt;else&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;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// is the number a multiple of 5?&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;buzz&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="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  STEP 5
&lt;/h2&gt;

&lt;p&gt;If we meet &lt;strong&gt;none&lt;/strong&gt; of those conditions, we'll just print out that number.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;fizzBuzz&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//is the number a multiple of 3 and 5?&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;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fizzbuzz&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="k"&gt;else&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;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// is the number a multiple of 3?&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fizz&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="k"&gt;else&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;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// is the number a multiple of 5?&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;buzz&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="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// none of the conditions above returned true&lt;/span&gt;
      &lt;span class="c1"&gt;// print out the current number we're looping through&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;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&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;I hope this was helpful for those just getting started with these kinds of problems :) &lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://www.pexels.com/@inspiredimages?utm_content=attributionCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=pexels"&gt;Anthony&lt;/a&gt; from Pexels&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Front-end Interview prep: resources</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Sun, 06 Dec 2020 22:26:13 +0000</pubDate>
      <link>https://dev.to/allisoncortez/front-end-interview-prep-resources-1hhe</link>
      <guid>https://dev.to/allisoncortez/front-end-interview-prep-resources-1hhe</guid>
      <description>&lt;p&gt;I've recently been preparing for frontend interviews and have compiled quite a list on my local drive. I wanted to share resources that have helped me in the past. This includes blog posts, Github Repos, other sites that have served as good sources of information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/XHM2W1ZBo3DJMDwRM2/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/XHM2W1ZBo3DJMDwRM2/giphy.gif" alt="person waving on zoom"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this is helpful for those going through this process! Also, feel free to share what your favorite resource has been or currently is. :)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;General Interview Prep&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.udemy.com/course/coding-interview-bootcamp-algorithms-and-data-structure/"&gt;Udemy's Coding Interview Bootcamp&lt;/a&gt;
I would highly suggest investing in this course! Stephen Grider does such an amazing job of breaking down these common interview questions. &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/seattledataguy/the-interview-study-guide-for-software-engineers-764"&gt;Ben Rogojan's Study Guide&lt;/a&gt;
shoutout to Ben for this lengthy and super helpful post!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Frontend specific&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/h5bp/Front-end-Developer-Interview-Questions"&gt;Github repo of Frontend specific Q's&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/yangshun/front-end-interview-handbook"&gt;Yangshun's Frontend Interview Handbook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/javascript-in-plain-english/react-v16-technical-interview-questions-1d9b85e6167d"&gt;GP Lee's Article on React Technical Q's&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/better-programming/quiz-how-well-do-you-know-your-js-fundamentals-df813504ff53"&gt;A fun JS Fundamentals Quiz by Alison Quaglia&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Algorithm prep&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/top-10-algorithms-in-interview-questions/#algo2"&gt;GeeksforGeeks Algorithm Q's&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/explore/interview/card/top-interview-questions-easy/"&gt;Leetcode's Easy and Medium collections&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/explore/learn"&gt;Leetcode's Learn section&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Photo by &lt;a href="https://www.pexels.com/@fauxels?utm_content=attributionCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=pexels"&gt;fauxels&lt;/a&gt; from Pexels&lt;/p&gt;

</description>
      <category>career</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>JS Spread Operator: How It Works and Why It's Useful</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Mon, 30 Nov 2020 03:29:01 +0000</pubDate>
      <link>https://dev.to/allisoncortez/js-spread-operator-how-it-works-and-why-it-s-useful-j50</link>
      <guid>https://dev.to/allisoncortez/js-spread-operator-how-it-works-and-why-it-s-useful-j50</guid>
      <description>&lt;p&gt;The spread operator is a super useful piece of syntax, introduced with the ES6/ ES2015 version of Javascript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main Function&lt;/strong&gt;&lt;br&gt;
The spread operator allows an iterable (array expression or string) to be expanded. So what does that even mean?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basically, there are 3 places to use spread:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;function calls(executing a function)&lt;/li&gt;
&lt;li&gt;array literals (making a new array)&lt;/li&gt;
&lt;li&gt;object literals (making a new object)&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Function Calls
&lt;/h2&gt;

&lt;p&gt;Lets say we have an array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;emojis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sad face&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;happy face&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;heart&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sun&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If I console.log, I would get back an array of strings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&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;emojis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; ["sad face", "happy face", "heart", "sun"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What if I just wanted the content inside of the array? This is where the spread operator comes in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&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;tvShows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; sad face happy face heart sun&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The spread operator gives us the capability of extracting these values from the array.&lt;/p&gt;

&lt;p&gt;Summary:&lt;br&gt;
We can spread an iterable into separate arguments in a function call. &lt;/p&gt;
&lt;h2&gt;
  
  
  Array Literals
&lt;/h2&gt;

&lt;p&gt;Quickly copy, add on, and create arrays based on existing arrays.&lt;/p&gt;

&lt;p&gt;Let's say we have the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;dogs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bud&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Champion&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;cats&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Stella&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Dolly&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What if I want to join these 2 arrays? I could do something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;pets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;dogs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cats&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; [Array(2), Array(3)]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The return value would be a nested array.&lt;/p&gt;

&lt;p&gt;What if I just want to get back one array?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;pets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;dogs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;cats&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; ["Bud", "Champion", "Stella", "Dolly"] // YAY!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: order DOES matter. Because we put in dogs before cats, we got dogs first on the list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;more examples:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;dogs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Buddy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cats&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Chester&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt;["Bud", "Champion", "Buddy", "Stella", "Dolly", "Chester"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Copying Arrays(this works for objects too)
&lt;/h2&gt;

&lt;p&gt;Let's say we want to make copies of the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;colors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;green&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;yellow&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Javascript, if you set a variable equal to an existing array, they are linked and will point to the same thing in memory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;colorCopy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;colors&lt;/span&gt;
&lt;span class="nx"&gt;colorCopy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;colorCopy&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; ["green","blue", "yellow", "white"]&lt;/span&gt;

&lt;span class="nx"&gt;colors&lt;/span&gt; &lt;span class="c1"&gt;// original array also got updated :(&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; ["green","blue", "yellow", "white"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this updates our copy, but it ALSO updates our original. That's not what we want!&lt;/p&gt;

&lt;p&gt;One good reason for using the spread operator is that it is non-destructive. Here's how we can make a copy of the original, without manipulating the original array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;colorCopy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;colorCopy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;colorCopy&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; ["green","blue", "yellow", "white"]&lt;/span&gt;

&lt;span class="nx"&gt;colors&lt;/span&gt; &lt;span class="c1"&gt;// original array&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; ["green","blue", "yellow"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: spread only goes one level deep when copying an array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Using the spread operator can be so useful! I hope this was a helpful breakdown.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=pYI-UuZVtHI"&gt;Colt Steele&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax"&gt;MDN Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Photo by &lt;a href="https://www.pexels.com/@daria?utm_content=attributionCopyText&amp;amp;utm_medium=referral&amp;amp;utm_source=pexels"&gt;Daria Shevtsova&lt;/a&gt; from Pexels&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>productivity</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>JS Fundamentals: Scope explained</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Mon, 23 Nov 2020 00:13:50 +0000</pubDate>
      <link>https://dev.to/allisoncortez/js-fundamentals-scope-explained-5ekm</link>
      <guid>https://dev.to/allisoncortez/js-fundamentals-scope-explained-5ekm</guid>
      <description>&lt;h2&gt;
  
  
  What is Scope?
&lt;/h2&gt;

&lt;p&gt;Scope is the concept of where something is available. The actual MDN definition states it's &lt;code&gt;the context in which values and expressions are "visible" or can be referenced.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In Javascript, there are 3 types of scope: &lt;strong&gt;Global, Function, and Block Scope.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Global Scope
&lt;/h2&gt;

&lt;p&gt;When a variable or function has a global scope, that means it can be accessed everywhere in our code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I'm a global variable!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;myFunct&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;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// has access to 'a' since it has global scope.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;myFunct&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// 'I'm a global variable!'.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; If a variable or function is NOT declared inside a function or block, it most likely falls under the global scope.&lt;/p&gt;

&lt;h2&gt;
  
  
  Function Scope
&lt;/h2&gt;

&lt;p&gt;When variables, functions, or parameters are declared inside of a certain function, they are only accessible within that specific function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;eatDinner&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Turkey&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="s2"&gt;`I love &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;eatDinner&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// 'I love Turkey!'&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;item&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 'ReferenceError: item is not defined.'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From outside of the function, we can't reference anything declared inside of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Block Scope
&lt;/h2&gt;

&lt;p&gt;A block statement creates its own scope.&lt;/p&gt;

&lt;p&gt;Variables declared with &lt;code&gt;var&lt;/code&gt; are &lt;strong&gt;not&lt;/strong&gt; block-scoped.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;myVar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;myVar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// =&amp;gt; 42&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Variables declared with &lt;code&gt;const&lt;/code&gt; and &lt;code&gt;let&lt;/code&gt; &lt;strong&gt;are&lt;/strong&gt; block-scoped.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&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;myVar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;secondVar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;myVar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Uncaught ReferenceError: myVar is not defined&lt;/span&gt;

&lt;span class="nx"&gt;secondVar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Uncaught ReferenceError: secondVar is not defined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Things to keep in mind when defining scope
&lt;/h2&gt;

&lt;p&gt;Variables created without const, let, or var keywords will be globally-scoped, regardless of where they are in your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hey guys&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// global scope&lt;/span&gt;
&lt;span class="nx"&gt;holiday&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Thanksgiving&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// global scope&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;lastName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Cortez&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// global scope&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Allison&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// block scope&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; "Cortez"&lt;/span&gt;
&lt;span class="nx"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// 'ReferenceError'&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Generally, you should never use global variables. &lt;/p&gt;

&lt;p&gt;For example, say you're storing sensitive information...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;userAccount&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secretPassword&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;password&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; "secretPassword"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In our example, we probably wanted our password variable to have a function scope.. BUT since it had global scope, we got access to sensitive information when we shouldn't have.&lt;/p&gt;

&lt;p&gt;It's best practice to make variables and functions available only where they're needed. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Scope"&gt;MDN Scope&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>My first month as a post-graduate from bootcamp</title>
      <dc:creator>Allison Cortez</dc:creator>
      <pubDate>Sun, 15 Nov 2020 16:55:48 +0000</pubDate>
      <link>https://dev.to/allisoncortez/my-first-month-as-a-post-graduate-from-bootcamp-1ggg</link>
      <guid>https://dev.to/allisoncortez/my-first-month-as-a-post-graduate-from-bootcamp-1ggg</guid>
      <description>&lt;p&gt;It's been about a month since I graduated from the Flatiron School. Even though it's only been a few weeks, I feel that I have learned so much in my post-grad journey!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3o6Ztb8w8H1ckNzVFS/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3o6Ztb8w8H1ckNzVFS/giphy.gif" alt="opening a book"&gt;&lt;/a&gt;&lt;br&gt;
I've compiled a list of resources, general tips, and broken down some habits that have worked for me in my first month since graduating. My hope is that this is insightful or even helpful for others in a similar position.&lt;/p&gt;

&lt;h2&gt;
  
  
  Productivity/Tracking
&lt;/h2&gt;

&lt;h4&gt;
  
  
  RESOURCE: &lt;a href="https://www.google.com/sheets/about/"&gt;Google Sheets&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Tracking my progress has been essential for me. This has helped me stay organized and keep up with my goals for the week. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I keep track of jobs I've applied to, jobs I plan to apply to for the week, and any interviews or meetings/calls I've had with potential employers.&lt;/li&gt;
&lt;li&gt;I TRY to code every day and write at least one blog per week.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/l0HlMlX4aKMk10hhe/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l0HlMlX4aKMk10hhe/giphy.gif" alt="awesome!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Learning, Refreshers, and Games to keep coding and keep learning.
&lt;/h2&gt;

&lt;p&gt;This is tailored toward the front-end.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://css-tricks.com/"&gt;CSS Tricks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/"&gt;MDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://frontendmasters.com/"&gt;Frontend Masters&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://javascript30.com/"&gt;Javascript 30&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://flexboxfroggy.com/"&gt;Flexbox Froggy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.udemy.com/course/react-redux/"&gt;Udemy, Modern React with Redux 2020 update&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://duckduckgo.com/"&gt;DuckDuckGo&lt;/a&gt; - an obvious one. If I don't know something, I take the time to find the answer.&lt;/li&gt;
&lt;li&gt;MAKING THINGS AND BREAKING THEM, FIXING THEM, THEN ADDING MORE FEATURES AND REPEATING THIS PROCESS- Really this bullet should be at the top.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Community
&lt;/h2&gt;

&lt;p&gt;Community has been so crucial in my post-grad journey. I would highly recommend getting involved in your local tech community, going to virtual meetups, talking with people in the industry. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3o6ZtjzD9JrHNgGl3y/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3o6ZtjzD9JrHNgGl3y/giphy.gif" alt="people dancing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://www.womenwhocode.com/"&gt;WomenWhoCode&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;virtual meetups, job boards, and Slack spaces. See if there is one for your specific city!&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://techqueria.org/"&gt;Techqueria Slack&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;a 501c3 nonprofit that empowers Latinx professionals with the resources and support that they need to thrive and become leaders in the tech industry. They have the most active slack I've ever been apart of, and everyone is so supportive!&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://www.diversifytech.co/"&gt;Diversify Tech&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;job board for women, minorities, and other underrepresented groups&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://www.meetup.com/CoLabs-The-Detroit-Labs-Developer-Community/"&gt;CoLabs&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Detroit Labs Developer community. Meet once a month, great group of individuals! :)&lt;/p&gt;

&lt;h2&gt;
  
  
  Interview Prep
&lt;/h2&gt;

&lt;p&gt;Nothing really new here, It's what everyone says helps and honestly, everyone is right.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.udemy.com/course/coding-interview-bootcamp-algorithms-and-data-structure/"&gt;Udemy, The Coding Interview Bootcamp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interviewcake.com/"&gt;Interview Cake&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leetcode.com/explore/interview/card/top-interview-questions-easy/"&gt;Leetcode&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  General Tips
&lt;/h2&gt;

&lt;p&gt;be humble, be kind, be genuine. At the end of the day, we're all just humans trying to survive 2020.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3o6Zta25YlO6XPcGPe/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3o6Zta25YlO6XPcGPe/giphy.gif" alt="Bob Ross impression"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Even though I am not speaking as a person who HAS landed their first dev role, I wanted to be open about my process, which I feel is equally as important. I hope it's helpful for others in the same position right now.&lt;/p&gt;

&lt;p&gt;What's helped you along your journey?&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>career</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
