<?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: Fantástico Sr. Fox 📸</title>
    <description>The latest articles on DEV Community by Fantástico Sr. Fox 📸 (@mrdebfx).</description>
    <link>https://dev.to/mrdebfx</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%2F160847%2Fed3fd206-5ea6-416e-bc0e-e3c44d8b6ff8.jpg</url>
      <title>DEV Community: Fantástico Sr. Fox 📸</title>
      <link>https://dev.to/mrdebfx</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mrdebfx"/>
    <language>en</language>
    <item>
      <title>Knowing the right Map🗺: .map() vs map()</title>
      <dc:creator>Fantástico Sr. Fox 📸</dc:creator>
      <pubDate>Fri, 15 Jul 2022 17:37:05 +0000</pubDate>
      <link>https://dev.to/mrdebfx/knowing-the-right-map-map-vs-map-3d79</link>
      <guid>https://dev.to/mrdebfx/knowing-the-right-map-map-vs-map-3d79</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uCEms0R1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgflip.com/6kbc3g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uCEms0R1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgflip.com/6kbc3g.jpg" alt="Spiderman Meme" width="704" height="354"&gt;&lt;/a&gt;&lt;br&gt;
As someone that’s learning the ins and outs of JavaScript and React I found myself becoming inspired, confused, and frustrated with .map() …sorry, I meant  map()..hold on, I think .map() was right, then again...&lt;/p&gt;

&lt;p&gt;Ok, so in this post I'm going to give you a short rundown on both so you'll know how to choose the right map. &lt;/p&gt;

&lt;p&gt;Let’s get started!&lt;/p&gt;
&lt;h2&gt;
  
  
  .Map()
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Array.prototype.map()&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This one is a method that creates a new array with populated results from calling a function and iterating through each element within the array. So after it’s all said and done there are two arrays, the original and the array that was created or manipulated with the method.&lt;/p&gt;

&lt;p&gt;I was first introduced to this through a React tutorial where &lt;a href="https://www.youtube.com/watch?v=G-Cr00UYokU&amp;amp;t=3049s"&gt;EGATOR&lt;/a&gt; used it to populate a collection of portfolio projects. &lt;/p&gt;

&lt;p&gt;After seeing this and how useful it was, I wanted to incorporate it into my portfolio, but first I needed to understand it more.&lt;/p&gt;

&lt;p&gt;Here's a quick and simple example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const nums = [12,5,10,7];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I have a simple array with 4 values and I want to multiple every number in the array by 3. &lt;/p&gt;

&lt;p&gt;First we create a variable and set it equal to the array with map like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const numsByThree = nums.map()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Array map Method takes a function with two parameters, the current value (required) and the index (optional). &lt;/p&gt;

&lt;p&gt;In this example the current value will be 'x'. In order to have the numbers multiplied by 3 we need to get each value in the array, then with an arrow function we take x and multiply it by 3. With everything put together it would look something like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const numsByThree = nums.map(x =&amp;gt; x * 3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first x retrieves the value in each index then once it has the value it’s brought back to complete the action, multiply by 3. &lt;/p&gt;

&lt;p&gt;Remember when I had said that with .map(), you’re essentially creating two arrays, well below you can see that we have two outputs with each array. If I were to change the value of the first array then the second would adjust to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const nums = [12,5,10,7];
///[12,5,10,7]
const numsByThree = nums.map(x () =&amp;gt; x * 3)
///[36,15,30,21]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This type of map is only used in conjunction with an Array to help iterate through the data stored within it. So it can be really useful when you want to manipulate a lot of data from an array.&lt;/p&gt;

&lt;h2&gt;
  
  
  Map()
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Map Object&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A map object holds key-value pairs and remembers the original insertion order of the key. (&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map"&gt;MDN&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;With the Map you have 10 methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;clear() &lt;/li&gt;
&lt;li&gt;delete(key) &lt;/li&gt;
&lt;li&gt;entries()&lt;/li&gt;
&lt;li&gt;get(key)&lt;/li&gt;
&lt;li&gt;has(key)&lt;/li&gt;
&lt;li&gt;keys()&lt;/li&gt;
&lt;li&gt;set(key,value)&lt;/li&gt;
&lt;li&gt;values()&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When a for...of loop is used with it, it returns an array of the key and value, like this [key,value].&lt;/p&gt;

&lt;p&gt;The key in the Map can be anything, a string, a number, symbol, it doesn't matter but not like an Object, I'll go over that in a future post.&lt;/p&gt;

&lt;p&gt;Below is a quick snippet of how it works and how to store data.&lt;/p&gt;

&lt;p&gt;You start by initializing a new map object by using &lt;em&gt;new Map()&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const contacts = new Map()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When adding data, you use the &lt;em&gt;set()&lt;/em&gt; method, the first parameter is the key and the second is the value:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;contacts.set('Roger', '213-555-1234')&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;To get the value we use &lt;em&gt;get()&lt;/em&gt;. If we&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(contacts.get('Roger'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we will get the phone number.&lt;/p&gt;

&lt;p&gt;When it comes to the value parameter you can treat it like an object and include more information, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contacts.set('Roger', {phone:'213-555-1234', type:'cell-phone', address:'412 N Street'})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only downside to this I've found is that I cannot specifically pinpoint a value. So if I wanted to only output the address I can't. I can only output all the data that's stored under the key when I use &lt;em&gt;.get()&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;console.log(contacts.get('Roger'));&lt;/em&gt; will yield&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
phone:"2123-555-1234",
type:"cell-phone",
address:"412 N Street"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So to sum it all up,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;.map()&lt;/strong&gt; is a method of Array that allows you to retrieve and iterate through data within an array.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;map()&lt;/strong&gt; is an object and it’s used to store data in a key, value pair.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are trying to manipulate data within an array then the Array Map Method is what you can use but on the other hand if you're trying to store data, this is where you would use the Map Object.&lt;/p&gt;

&lt;p&gt;I hope this small post cleared up a lil confusion, but there are lots more information regarding the usage of .Map() and Map().&lt;/p&gt;

</description>
      <category>map</category>
      <category>javascript</category>
      <category>array</category>
      <category>object</category>
    </item>
    <item>
      <title>Installing Typescript/Angular on Terminal</title>
      <dc:creator>Fantástico Sr. Fox 📸</dc:creator>
      <pubDate>Sat, 08 Feb 2020 17:19:23 +0000</pubDate>
      <link>https://dev.to/mrdebfx/installing-typescript-angular-on-terminal-26de</link>
      <guid>https://dev.to/mrdebfx/installing-typescript-angular-on-terminal-26de</guid>
      <description>&lt;p&gt;I'm trying to install typescript and angular on my Mac to follow along a tutorial but I'm having the hardest time in the world. &lt;/p&gt;

&lt;p&gt;Nodejs is installed and to my knowledge is working, but after I input 'npm install -g typescript' I get a long list of npm ERR!'s with the top line being 'npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules'. &lt;/p&gt;

&lt;p&gt;I have no clue what that means nor how to resolve the issue, if anyone can help I will greatly appreciate it!&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>npm</category>
      <category>angular</category>
      <category>node</category>
    </item>
    <item>
      <title>Someone to review &amp; critique code</title>
      <dc:creator>Fantástico Sr. Fox 📸</dc:creator>
      <pubDate>Mon, 30 Dec 2019 17:30:02 +0000</pubDate>
      <link>https://dev.to/mrdebfx/someone-to-review-critique-code-537c</link>
      <guid>https://dev.to/mrdebfx/someone-to-review-critique-code-537c</guid>
      <description>&lt;p&gt;I created a webpage to practice my coding skills and UI design and for my portfolio. I’m hoping to find someone to review &amp;amp; critique my code and give feedback. &lt;/p&gt;

&lt;p&gt;My goal is to get a Jr Frontend Dev job or internship by Spring of 2020. Thank you!! &lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>scss</category>
      <category>ui</category>
    </item>
    <item>
      <title>Seeking Frontend Dev Mentor</title>
      <dc:creator>Fantástico Sr. Fox 📸</dc:creator>
      <pubDate>Sun, 08 Sep 2019 23:36:52 +0000</pubDate>
      <link>https://dev.to/mrdebfx/seeking-frontend-dev-mentor-2ejc</link>
      <guid>https://dev.to/mrdebfx/seeking-frontend-dev-mentor-2ejc</guid>
      <description>&lt;p&gt;Hello all, I'm reaching out to anything that might know of any possible mentors. I saw there was a beta program but the link is not working. I have pretty general knowledge of HTML, CSS, a bit of JavaScript but of course I want to improve these skills in hopes of getting an Frontend Dev internship! &lt;/p&gt;

&lt;p&gt;If you or anyone you know wouldn't mind offering digital one-on-one advice, tips, etc then let me know! I'm ready to learn! :)&lt;/p&gt;

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