<?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: Atila Fassina</title>
    <description>The latest articles on DEV Community by Atila Fassina (@atila).</description>
    <link>https://dev.to/atila</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%2F2606%2F09b9a4b1-15c2-4444-aeb6-bf7c0a0d1e03.png</url>
      <title>DEV Community: Atila Fassina</title>
      <link>https://dev.to/atila</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/atila"/>
    <language>en</language>
    <item>
      <title>Gradient Texts</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Fri, 22 Jan 2021 00:00:00 +0000</pubDate>
      <link>https://dev.to/atila/gradient-texts-ppe</link>
      <guid>https://dev.to/atila/gradient-texts-ppe</guid>
      <description>&lt;p&gt;Recently, I created a landing page where I used a few interesting gradient effects. You can check them at &lt;a href="https://atila.io/all-about-next" rel="noopener noreferrer"&gt;All About NextJS&lt;/a&gt;. Though not super complicated or complex, these techniques aren’t widely used. And that’s why they revolve around a CSS property that though it has been around for a while, it has never had reliable support by the rendering engines. I believe this is the reason why it’s partially forgotten.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background-Clip
&lt;/h2&gt;

&lt;p&gt;When checking on &lt;a href="https://caniuse.com/?search=background-clip" rel="noopener noreferrer"&gt;CanIUse&lt;/a&gt; the results can be somewhat misleading, each value has a different level of standardized support. And the value we’re about to use does not even figure in that shortlist.&lt;/p&gt;

&lt;p&gt;According to &lt;a href="https://mdn.io/background-clip" rel="noopener noreferrer"&gt;Mozilla Development Network&lt;/a&gt; the &lt;code&gt;background-clip&lt;/code&gt; property:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;(...)sets whether an element's background extends underneath its border box, padding box, or content box.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s try to break that technical &lt;em&gt;jibber jabber&lt;/em&gt; into plain English. Think of it as a &lt;em&gt;virtual kid‘s hole puncher&lt;/em&gt;. And I only say kids because adults are boring and only use circles, but when it’s for kids, they come in all shapes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzlw4w8af4ylpgg2dgla.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzlw4w8af4ylpgg2dgla.jpg" alt="hole puncher for kids" width="600" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I love a good analogy, so let’s ride this one for a little longer. The paper is our browser, the hole-puncher is the rendering engine, and the CSS will define the &lt;strong&gt;shape&lt;/strong&gt; of this hole. In that specific scenario, we want the whole to have the exact same shape of our text. So, guess what? &lt;code&gt;background-clip: text;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now it’s just a matter of styling the background as you normally would, and make the actual text transparent with &lt;code&gt;color: transparent&lt;/code&gt;. It will remain accessible to screen-readers and crawlers, but our background will handle the graphics. Check the codepen below:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/atilafassina/embed/jOMeyMX?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;It’s worth noting support is not great on every browser. Webkit and Blink accept only the flagged version: &lt;code&gt;-webkit-background-clip&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding some animation
&lt;/h2&gt;

&lt;p&gt;It is not possible to animate &lt;code&gt;background-image&lt;/code&gt;, but there is a workaround that will achieve a nice result. We can animate &lt;code&gt;background-position&lt;/code&gt;, and since our background is only colours, we can expand the &lt;strong&gt;size&lt;/strong&gt; of our background.&lt;/p&gt;

&lt;p&gt;So by stretching our background at 4x the size of our actual container, we can animate its positioning. Like the view passing by your car window as you travel through a road (so poetic!).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.animate-text&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;transparent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-background-clip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-clip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;400%&lt;/span&gt; &lt;span class="m"&gt;400%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;linear-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="m"&gt;45deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="m"&gt;#95f7d0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="m"&gt;#63b9be&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="m"&gt;#887dc5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="m"&gt;#d478ff&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="m"&gt;#ff94e7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="m"&gt;#fec6c0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="m"&gt;#fdff94&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="m"&gt;#b6f9bd&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;Check it at this pen:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/atilafassina/embed/ExgdZwP?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;h2&gt;
  
  
  Gradient borders
&lt;/h2&gt;

&lt;p&gt;Now, the most interesting are the 2 above, but this one is so fun that I felt like adding too. When not dealing with text, we can also play around by adding some animated gradient borders. Fancy!&lt;/p&gt;

&lt;p&gt;Check it out!&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/atilafassina/embed/YzGJNar?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;It‘s a similar technique as the ones above, but instead of relying on &lt;code&gt;background-clip&lt;/code&gt; it creates an outer-wrapper with the background gradient, and position its only child with an opaque background.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.box&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/*
  we set border-radius as a custom-property
  this way elements always match
  */&lt;/span&gt;
  &lt;span class="py"&gt;--border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;300px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;150px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;place-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c"&gt;/*
    same gradient as above
    hiding in a custom-prop to enhance readability
  */&lt;/span&gt;
  &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--gradient&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--border-radius&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;background-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;400%&lt;/span&gt; &lt;span class="m"&gt;400%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;animateGradient&lt;/span&gt; &lt;span class="m"&gt;5s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt; &lt;span class="n"&gt;infinite&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.inner-box&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;95%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;90%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--border-radius&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;
  
  
  More CSS tips?
&lt;/h2&gt;

&lt;p&gt;Check out my other post  &lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/atila" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2606%2F09b9a4b1-15c2-4444-aeb6-bf7c0a0d1e03.png" alt="atila"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/atila/5-clever-tips-on-css-1i0h" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;5 Clever tips on CSS&lt;/h2&gt;
      &lt;h3&gt;Atila Fassina ・ Aug 7 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#codenewbie&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#codepen&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;p&gt;What about you? Is there any obscure CSS feature that you have used lately? Or can you think about another nice use-case for &lt;code&gt;background-clip&lt;/code&gt; ? I’d love to hear from you on this. Reach out on twitter and let me know!&lt;/p&gt;




&lt;p&gt;Cover Photo by &lt;a href="https://unsplash.com/s/photos/gradient" rel="noopener noreferrer"&gt;Elliott Engelmann&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>showdev</category>
      <category>codenewbie</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Your first NodeJS Executable</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Thu, 03 Sep 2020 05:10:59 +0000</pubDate>
      <link>https://dev.to/atila/your-first-nodejs-executable-2kop</link>
      <guid>https://dev.to/atila/your-first-nodejs-executable-2kop</guid>
      <description>&lt;p&gt;Whenever you write a NodeJS (&lt;code&gt;.js&lt;/code&gt;) file, you can go to your terminal, enter the directory and run &lt;code&gt;node {{file-name}}.js&lt;/code&gt;. Ever wondered how some packages written in Node don't need this to run? Jest, Babel, Yarn, etc. A lot of them have their own commands. That's because they're &lt;strong&gt;executables&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;And turns out, it is quite straightforward to create an executable with NodeJS. You just need to follow a few steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring &lt;code&gt;package.json&lt;/code&gt; ⚙️
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;package.json&lt;/code&gt; has a property which is specifically to create this executable task, it's &lt;code&gt;bin&lt;/code&gt; field. So it will end up looking something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"create-netlify-ts"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0.1.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"index.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"repository"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"git@github.com:atilafassina/netlify-lambda-ts.git"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"author"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Atila Fassina &amp;lt;atila@fassina.eu&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"license"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"MIT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"bin"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"create-netlify-ts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"index.js"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In that case, my entry file (the one which pulls all other modules and where the task will execute from, is the &lt;code&gt;./index.js&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Instruct the terminal 🤖
&lt;/h2&gt;

&lt;p&gt;Your terminal runs on &lt;code&gt;bash&lt;/code&gt;, or &lt;code&gt;zsh&lt;/code&gt;, or &lt;code&gt;fish&lt;/code&gt;, ... it doesn’t really matter. Just add a comment to the top of your file specifying it needs to run on Node.&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="cp"&gt;#!/usr/bin/env node
&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &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="nf"&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;Executing executable&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Permission to execute 💂‍♀️
&lt;/h2&gt;

&lt;p&gt;As a security measure, files are not executable by default. It's necessary to tap into the access permissions of our entry file (&lt;code&gt;index.js&lt;/code&gt; in this example).&lt;/p&gt;

&lt;p&gt;If you’re on a UNIX based system (MacOS, Linux), you can go to your terminal, navigate to the working directory of your project and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again, &lt;code&gt;index.js&lt;/code&gt; is our example here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link for local development 🔗
&lt;/h2&gt;

&lt;p&gt;As a responsible developer, you want to check if things are in place before shipping. Now is the time to tell your package manager (yarn or npm) to instead of look for your package in the global &lt;code&gt;node_modules&lt;/code&gt;, to look at your local directory.&lt;/p&gt;

&lt;p&gt;You navigate to the root of your project (the directory &lt;code&gt;package.json&lt;/code&gt; is located) and run&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;When you're done, you can &lt;code&gt;unlink&lt;/code&gt; and things will go back to normal.&lt;/p&gt;

&lt;p&gt;Now you're free to run your command as much as you want in your system, go back, make changes, and changes will pick up instantly (as we don't have a build step involved yet).&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s next? 🚀
&lt;/h2&gt;

&lt;p&gt;Talking about build steps, it would be cool to add some type safety, maybe even some transpiling to it right?&lt;/p&gt;

&lt;p&gt;For sure that would be rad. We’ll check how to do that on my next post, as well as how to publish it properly to npm, so it can work with &lt;code&gt;npx&lt;/code&gt; and &lt;code&gt;yarn create&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the meanwhile, enjoy your first node executable and let me know down in the comments if you enjoyed this post and is waiting for the sequence! 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  💌
&lt;/h2&gt;

&lt;p&gt;If you found this post useful, please consider &lt;a href="https://twitter.com/intent/tweet?text=This%20post%20is%20worth%20a%20read:%20https://dev.to/atila/your-first-nodejs-executable-2kop%20by%20@AtilaFassina"&gt;sharing it with your network&lt;/a&gt;, that would help me a lot to continue creating more content like this. 😁&lt;/p&gt;




&lt;p&gt;Cover photo by &lt;a href="https://unsplash.com/photos/LqKhnDzSF-8" rel="noopener noreferrer"&gt;Joshua Sortino on Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>tutorial</category>
      <category>node</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Introducing: create-netlify-ts</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Mon, 31 Aug 2020 11:12:04 +0000</pubDate>
      <link>https://dev.to/atila/introducing-create-netlify-ts-30fj</link>
      <guid>https://dev.to/atila/introducing-create-netlify-ts-30fj</guid>
      <description>&lt;p&gt;From my perspective, the JAMstack is specially appealing to developers with a frontend background. We can now deploy backend services without needing a deep understanding of server-side architecture, scalability, or even caching. &lt;/p&gt;

&lt;p&gt;With that in mind, I have started a new project &lt;code&gt;create-netlify-ts&lt;/code&gt;. My point with this project is leverage the self-documenting aspect of TypeScript to lower the barrier for Lambda-Functions even more.&lt;/p&gt;

&lt;h2&gt;
  
  
  How ❓
&lt;/h2&gt;

&lt;p&gt;Well, by using the self-documenting aspect of TypeScript. On strongly typed code (and luckily with an IDE properly configured), your methods will &lt;em&gt;whisper&lt;/em&gt; to you what they need.&lt;/p&gt;

&lt;p&gt;But, adding TypeScript to a NodeJS adds a new layer of complexity. Node doesn't get types, so the simplicity of writin a &lt;code&gt;.js&lt;/code&gt; file and pushing so it's ✨magically✨ live on Netlify goes away.&lt;/p&gt;

&lt;p&gt;In comes &lt;code&gt;netlify-lambda&lt;/code&gt; to add a build step to your &lt;strong&gt;Netlify Function&lt;/strong&gt;. I wrote a small tutorial on getting this running.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/atila" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2606%2F09b9a4b1-15c2-4444-aeb6-bf7c0a0d1e03.png" alt="atila"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/atila/netlify-functions-typescript-3b3i" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Deploy Netlify Functions with TypeScript&lt;/h2&gt;
      &lt;h3&gt;Atila Fassina ・ Aug 10 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#codenewbie&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#serverless&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#typescript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;But even if you know this setup inside-out and backwards, it is a bit annoying to make it every.single.time.&lt;/p&gt;

&lt;p&gt;I know that feeling. So I made something.&lt;/p&gt;

&lt;h2&gt;
  
  
  Faster than instant noodles 🥡
&lt;/h2&gt;

&lt;p&gt;With a simple command in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# if you use Yarn
yarn create netlify-ts

# if you use NPM
npx create-netlify-ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;A new project is bootstrapped for you, ready to be deployed on Netlify Functions with another simple command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F32qaq83flpp8ws5d0g8b.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F32qaq83flpp8ws5d0g8b.gif" alt="gif of the terminal prompt with questions" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The boilerplate is a bit more than the minimum requirements for a working Netlify Function. It can give you some opinionated coding style (very little), and also brings the &lt;code&gt;request&lt;/code&gt; and &lt;code&gt;response&lt;/code&gt; types, so you can easily write the logic of your service without ever &lt;code&gt;alt-tabbing&lt;/code&gt; away from the IDE.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/atilafassina" rel="noopener noreferrer"&gt;
        atilafassina
      &lt;/a&gt; / &lt;a href="https://github.com/atilafassina/create-netlify-ts" rel="noopener noreferrer"&gt;
        create-netlify-ts
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      👟 Building Netlify Functions with TypeScript has never been this easy
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/atilafassina/create-netlify-ts./netlify-ts.png"&gt;&lt;img width="300" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fatilafassina%2Fcreate-netlify-ts.%2Fnetlify-ts.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;create-netlify-ts&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;👟 Building Netlify Functions with TypeScript easily&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;📦 Package Manager agnostic&lt;/p&gt;

&lt;p&gt;🐾 No production footprint&lt;/p&gt;

&lt;p&gt;🚀 Ready to deploy&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;❯_&lt;/h2&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;npm&lt;/h3&gt;
&lt;/div&gt;

&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;npx create-netlify-ts
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;yarn&lt;/h3&gt;

&lt;/div&gt;

&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;yarn create netlify-ts
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;❓ Answer the questions and start coding!&lt;/p&gt;
&lt;div&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/atilafassina/create-netlify-ts/netlify-ts.gif"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fatilafassina%2Fcreate-netlify-ts%2Fnetlify-ts.gif" alt="Terminal showing create-netlify-ts working"&gt;&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🌲 File tree&lt;/h2&gt;

&lt;/div&gt;

&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt; {{ package-name }}
  ├── src
  │   └── {{ your-function-name }}.ts
  ├── package.json
  ├── .babelrc
  ├── .gitignore
  └── netlify.toml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🧳 Installed dependencies&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;All depdendencies are installed as &lt;code&gt;devDependencies&lt;/code&gt;, &lt;strong&gt;create-netlify-ts&lt;/strong&gt; has no footprint on your production code.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Required dependencies&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;br&gt;
&lt;thead&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;th&gt;Package Name&lt;/th&gt;
&lt;br&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;/thead&gt;
&lt;br&gt;
&lt;tbody&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;td&gt;netlify-lambda&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;Adds build-step to Netlify Functions&lt;/td&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;td&gt;typescript&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;The compiler for TypeScript (&lt;code&gt;tsc&lt;/code&gt;)&lt;/td&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;td&gt;
&lt;a class="mentioned-user" href="https://dev.to/babel"&gt;@babel&lt;/a&gt;/preset-env&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;Tells Babel which JavaScript syntax to output&lt;/td&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;td&gt;
&lt;a class="mentioned-user" href="https://dev.to/babel"&gt;@babel&lt;/a&gt;/preset-typescript&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;Teach Babel to use TypeScript compiler&lt;/td&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;tr&gt;
&lt;br&gt;
&lt;td&gt;@types/aws-lambda&lt;/td&gt;
&lt;br&gt;
&lt;td&gt;Request/Response types for AWS Lambdas†&lt;/td&gt;
&lt;br&gt;
&lt;/tr&gt;
&lt;br&gt;
&lt;/tbody&gt;
&lt;br&gt;
&lt;/table&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;†: Netlify Functions runs on top of AWS-Lambdas&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Optional dependencies&lt;/h3&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.netlify.com/cli/get-started/" rel="nofollow noopener noreferrer"&gt;Netlify CLI&lt;/a&gt; To run Netlify Functions locally&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://prettier.io" rel="nofollow noopener noreferrer"&gt;Prettier&lt;/a&gt;: with some opinionated configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🛫 Flying solo&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;It‘s a dangerous road out there. Take these:&lt;/p&gt;

&lt;p&gt;📹 &lt;a href="https://www.youtube.com/watch?v=3-Ie6p5ySKQ" rel="nofollow noopener noreferrer"&gt;Write&lt;/a&gt;…&lt;/p&gt;
&lt;/div&gt;


&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/atilafassina/create-netlify-ts" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h2&gt;
  
  
  Features ✨
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Server &lt;code&gt;Rewrite&lt;/code&gt; to the root of your domain&lt;/li&gt;
&lt;li&gt;Deploy setup&lt;/li&gt;
&lt;li&gt;Optional dependencies to streamline your workflow&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Requirements ❗️
&lt;/h2&gt;

&lt;p&gt;There are 2 things which I have not been able to workaround if it is the first time deploying to Netlify for you.&lt;/p&gt;

&lt;p&gt;You need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Manually create your Netlify account beforehand&lt;/li&gt;
&lt;li&gt;If using &lt;strong&gt;Netlify CLI&lt;/strong&gt; you need to link your account with the CLI manually as well&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Help wanted 🏆
&lt;/h2&gt;

&lt;p&gt;Create-Netlify-TS is on a very early stage, and I welcome any kind of contribution. For example, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;offer feedback on your usage&lt;/li&gt;
&lt;li&gt;suggest improvements on existing features and configuration&lt;/li&gt;
&lt;li&gt;add more testing coverage&lt;/li&gt;
&lt;li&gt;automate some needed tasks (package publishing for example)&lt;/li&gt;
&lt;li&gt;anything else you can think of, pop an issue and let's talk!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💌
&lt;/h2&gt;

&lt;p&gt;If you found this project useful, please consider &lt;a href="https://twitter.com/intent/tweet?text=This%20is%20a%20cool%20project%20https://github.com/atilafassina/create-netlify-ts%20by%20@AtilaFassina" rel="noopener noreferrer"&gt;sharing it with your network&lt;/a&gt;, that would help me a lot to continue and make improvements. 😁&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>serverless</category>
      <category>typescript</category>
      <category>node</category>
    </item>
    <item>
      <title>Deploy Netlify Functions with TypeScript</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Mon, 10 Aug 2020 10:58:59 +0000</pubDate>
      <link>https://dev.to/atila/netlify-functions-typescript-3b3i</link>
      <guid>https://dev.to/atila/netlify-functions-typescript-3b3i</guid>
      <description>&lt;p&gt;Netlify has recently reached 1 MILLION DEVELOPERS. That’s &lt;em&gt;a lot&lt;/em&gt; of happy consumers. To celebrate that, here‘s a step-by-step guide to deploy your very own Netlify Function with TypeScript.&lt;/p&gt;

&lt;p&gt;📹 If you prefer, you can have this post as a screencast video.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/3-Ie6p5ySKQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Please don’t forget to 👍 and 🔔 on your way out if it helped you. It would help me a ton!!! 💕&lt;/p&gt;

&lt;p&gt;Also, check the whole source code on &lt;a href="https://github.com/atilafassina/monster-as-service" rel="noopener noreferrer"&gt;github/monster-as-a-service&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring &lt;code&gt;netlify.toml&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Our first needed step is to configure our Netlify deploy. If you prefer, you can set this up on the dashboard as well, but I find the configuring file more straightforward. To each their own, though.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[build]&lt;/span&gt;
  &lt;span class="py"&gt;command&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"yarn build"&lt;/span&gt;
  &lt;span class="py"&gt;functions&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"lambda"&lt;/span&gt;

&lt;span class="c"&gt;# this is actually a Rewrite&lt;/span&gt;
&lt;span class="c"&gt;# totally optional, but makes up for&lt;/span&gt;
&lt;span class="c"&gt;# a much better UX&lt;/span&gt;
&lt;span class="nn"&gt;[[redirects]]&lt;/span&gt;
  &lt;span class="py"&gt;from&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"/"&lt;/span&gt;
  &lt;span class="py"&gt;to&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"/.netlify/functions/index"&lt;/span&gt;
  &lt;span class="py"&gt;status&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Teaching TypeScript to Babel
&lt;/h2&gt;

&lt;p&gt;Now we need to setup our &lt;code&gt;.babelrc&lt;/code&gt; so Babel can use the TypeScript compiler (&lt;code&gt;tsc&lt;/code&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"presets"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"@babel/preset-typescript"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"@babel/preset-env"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"targets"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create your script tasks
&lt;/h2&gt;

&lt;p&gt;Almost done, run over to your &lt;code&gt;package.json&lt;/code&gt; and add the two tasks you’re going to need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"build": "netlify-lambda build src",
"ts-check": "tsc --noEmit --lib ES2015 ./src/*.ts"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only mandatory one is &lt;code&gt;build&lt;/code&gt;, but I imagine you will want to be able to check all your types at some point. For any production level TypeScript code I’d consider a good practice to check your types on CI pipeline, at the very least.&lt;/p&gt;

&lt;p&gt;🚨 That's because Babel will not check your types, simply run the compiler.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bare bones function with TypeScript
&lt;/h2&gt;

&lt;p&gt;The only thing you need to have a working Netlify Function is to export a &lt;code&gt;handler&lt;/code&gt; method from your &lt;code&gt;.js&lt;/code&gt; or &lt;code&gt;.ts&lt;/code&gt; file. Netlify Functions run AWS-Lambdas under the hood. So, to have your &lt;code&gt;handler&lt;/code&gt; typed, you can simply add &lt;code&gt;types/aws-lambda&lt;/code&gt; and you’re good to go.&lt;/p&gt;

&lt;p&gt;Here’s a useful example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;APIGatewayEvent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Context&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;aws-lambda&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;APIGatewayEvent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Context&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;queryStringParameters&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&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="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;msg&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;In that case, if you hit &lt;code&gt;https://your-lambda.netlify.app?msg=BlackLivesMatter&lt;/code&gt; if will return the following &lt;code&gt;json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; 
  &lt;/span&gt;&lt;span class="nl"&gt;"msg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"BlackLivesMatter"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I recommend you to install &lt;code&gt;netlify-dev&lt;/code&gt; globally so you can simulate production environment in your machine. If you have the package, you can run &lt;code&gt;netlify dev&lt;/code&gt; and it will boot up a server for you and expose your lambda on &lt;code&gt;https://localhost:8888&lt;/code&gt; by default.&lt;/p&gt;

&lt;p&gt;If linked to your Netlify Account, the CLI will also allow you to deploy your project without pushing it to anywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy
&lt;/h2&gt;

&lt;p&gt;Netlify offers you a few ways of deploying your code. The most common is by setting Continuous Deployment by integrating it with your Github, Gitlab, or Bitbucket account.&lt;/p&gt;

&lt;p&gt;Another way to do it though, is using &lt;code&gt;Netlify-Dev&lt;/code&gt; CLI and hitting &lt;code&gt;netlify deploy&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  💌
&lt;/h2&gt;

&lt;p&gt;In case you have found this post useful, please consider &lt;a href="https://twitter.com/intent/tweet?text=I%20enjoyed%20this%20article%20on%20@ThePracticalDev:%20https://dev.to/atila/netlify-typescript%20by%20@AtilaFassina"&gt;sharing it with your network&lt;/a&gt;, that would help me a lot to continue sharing posts like this and others. 😁&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>serverless</category>
      <category>typescript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>5 Clever tips on CSS</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Fri, 07 Aug 2020 04:54:41 +0000</pubDate>
      <link>https://dev.to/atila/5-clever-tips-on-css-1i0h</link>
      <guid>https://dev.to/atila/5-clever-tips-on-css-1i0h</guid>
      <description>&lt;p&gt;The 5 cleverest CSS tips I have collected in the last few months.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clamp
&lt;/h2&gt;

&lt;p&gt;Perfect for &lt;code&gt;font-size&lt;/code&gt;, for example. Replace most of your media-queries for it with that.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does it do?
&lt;/h3&gt;

&lt;p&gt;Sets a value between lower and upper bounds. It‘s like setting up &lt;code&gt;min&lt;/code&gt;/&lt;code&gt;max&lt;/code&gt; values and a relative in between.&lt;/p&gt;

&lt;p&gt;Open this pen in a new tab and resize the screen horizontally to see it at work.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/atilafassina/embed/OJyKEbq?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Emoji as icons
&lt;/h2&gt;

&lt;p&gt;I’ve come across this and used it most as fun experiment. But recently I have used in small standalone side-projects. Where a just wanted to quick and dirty add an icon for visual feedback.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to do it?
&lt;/h3&gt;

&lt;p&gt;Set your &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; to be transparent, and then use &lt;code&gt;text-shadow&lt;/code&gt; to show the silhouette of the icon.&lt;/p&gt;

&lt;p&gt;❗️ Remember to add &lt;code&gt;role="img"&lt;/code&gt; and an &lt;code&gt;aria-label&lt;/code&gt; to the &lt;code&gt;span&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/atilafassina/embed/yLYmOPV?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Everything can be a list
&lt;/h2&gt;

&lt;p&gt;Every wrapper element can have a counter, and using pseudo-elements (&lt;code&gt;::before&lt;/code&gt;, &lt;code&gt;::after&lt;/code&gt;) it’s quite easy to make them like an order list without being restrained by the &lt;code&gt;list-style&lt;/code&gt; property. You can also reset the counter at will and start counting from whichever point you want.&lt;/p&gt;

&lt;p&gt;❗️ Only recommended in very specific use-cases, always prefer the semantically correct tag. If you do use this technique, be sure to address a11y concerns!&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/atilafassina/embed/BaoXKPy?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Object Fit
&lt;/h2&gt;

&lt;p&gt;Defines how an image or a video will fit in its container.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is it good for?
&lt;/h3&gt;

&lt;p&gt;It is extremely useful to preserve aspect-ratio of images on galleries or other kinds of lists.&lt;/p&gt;

&lt;p&gt;Play around with the different values it can receive in this pen.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/atilafassina/embed/dyYxRWx?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Second Argument of &lt;code&gt;text-decoration&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Such a basic well-known property. Though I usually only see it being used with a single value while it actually is a shorthand to &lt;strong&gt;4&lt;/strong&gt; others.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;line&lt;/li&gt;
&lt;li&gt;style&lt;/li&gt;
&lt;li&gt;color&lt;/li&gt;
&lt;li&gt;thickness&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This pen emphasis the usage of the second argument. Which you can, in fact, combine multiple values such as &lt;code&gt;underline overline&lt;/code&gt;. Both are style values but they do not override each other if declared together.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/atilafassina/embed/ExVqKJL?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  💌
&lt;/h2&gt;

&lt;p&gt;In case you have found this post useful, please consider &lt;a href="https://twitter.com/intent/tweet?text=I%20enjoyed%20this%20article%20on%20@ThePracticalDev:%20https://dev.to/atila/5-clever-tips-on-css-1i0h%20by%20@AtilaFassina"&gt;sharing it with your network&lt;/a&gt;, that would help me a lot to continue sharing posts like this and others. 😁&lt;/p&gt;




&lt;p&gt;What about you? What’s a clever CSS feature that you like to use or have recently found out about? Let me know in the comments!! 🏆&lt;/p&gt;




&lt;p&gt;Cover Photo by &lt;a href="https://unsplash.com/photos/5E5N49RWtbA" rel="noopener noreferrer"&gt;davisco on Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>tutorial</category>
      <category>codenewbie</category>
      <category>codepen</category>
    </item>
    <item>
      <title>User Experience 💜 Developer Experience</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Wed, 05 Aug 2020 12:15:46 +0000</pubDate>
      <link>https://dev.to/atila/user-experience-developer-experience-1lne</link>
      <guid>https://dev.to/atila/user-experience-developer-experience-1lne</guid>
      <description>&lt;p&gt;Not long ago, I tweeted something about Developer Experience. Which had the most traction a tweet of mine has ever had, by far.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1268984709855526913-535" src="https://platform.twitter.com/embed/Tweet.html?id=1268984709855526913"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1268984709855526913-535');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1268984709855526913&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;It means to me I said something more people were willing say, or, at the very least, resonate with.&lt;/p&gt;

&lt;p&gt;So, let me try and expand on that. I look forward to some nice debate in case you disagree, or some feedback in case you just have something to say about it. So reach out and let‘s chat! 🙂&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Developer Experience?
&lt;/h2&gt;

&lt;p&gt;Let‘s not jump to assumptions that everyone has the same understanding about what Developer Experience (DX) is. Some replies from that tweet made it clear to me that we don‘t.&lt;/p&gt;

&lt;p&gt;❗️❗️&lt;/p&gt;

&lt;p&gt;If you aren’t keen to dig into this definition, you can skip to the next chapter. Otherwise, let’s make a philosophical exercise right now! 🙇‍♂️🙇‍♀️&lt;/p&gt;

&lt;p&gt;❗️❗️&lt;/p&gt;

&lt;p&gt;There‘s no definitive definition (pun intended), as Chris Coyer has said more elegantly on his &lt;a href="https://css-tricks.com/what-is-developer-experience-dx/" rel="noopener noreferrer"&gt;What is Developer Experience (DX)?&lt;/a&gt; post: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;(DX) is a term with a self-declaring meaning — the experience of developers — but it eludes definition in the sense that people invoke it at different times for different reasons referring to different things.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From the article, we can understand that DX is quite nuanced. Let‘s then briefly point out the different aspects of it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Companies&lt;/strong&gt;&lt;br&gt;
when the user-base of such company are actually developers. DX become a synonym of UX&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Technologies&lt;/strong&gt;&lt;br&gt;
when talking about experience provided by different frameworks or libraries&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Technology Context&lt;/strong&gt;&lt;br&gt;
when talking about things around said technologies. Documentation, Guides, Tutorials, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Technology Offerings&lt;/strong&gt;&lt;br&gt;
additions to platform on top of the context. CLI and helpers, for example.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Coding&lt;/strong&gt;&lt;br&gt;
the experience of typing code. IDE integrations, compile-time checks, hot reloading, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User Experience (UX)&lt;/strong&gt;&lt;br&gt;
Some say one degrades the other, some say one boosts the other.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Onboarding&lt;/strong&gt;&lt;br&gt;
the time a technology takes to be adopted, size of initial investment.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will excuse myself and shuffle those cards a bit so I can take some out of the deck to level our discussion. First of all, if developers are the consumers of a product, for constraints of this article: they are the users. So I will take the first 4 bullets and throw them on the User Experience pile.&lt;/p&gt;

&lt;p&gt;Now we‘re left with Coding, Onboarding, and the relationship with User Experience (UX).&lt;br&gt;
This third one is a paramount aspect of DX, without it our code will crumble down.&lt;/p&gt;

&lt;p&gt;It directly impacts the return over investment of the whole product, and therefore to DX. In other words: you can‘t have a good Developer Experience if you don‘t have a product, and you don‘t have a product if your User Experience can‘t retain users. See the chain reaction?&lt;/p&gt;
&lt;h2&gt;
  
  
  So what does DX really mean?
&lt;/h2&gt;

&lt;p&gt;Let‘s try and summarize what is Developer Experience with our added constraints:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The experience of developers when interacting with a piece of software. How smooth it is to &lt;strong&gt;understand&lt;/strong&gt;, &lt;strong&gt;use&lt;/strong&gt;, and/or &lt;strong&gt;alter the code&lt;/strong&gt; without impacting User Experience negatively.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  User Experience
&lt;/h2&gt;

&lt;p&gt;👉 End-user comes first, always!&lt;/p&gt;

&lt;p&gt;As we established before: the end-user is the person who keeps the lights on at any business. They not only pay for the product, but they‘re also the reason the company exists (in the most usual cases, at least). It‘s only fair that such a core aspect of a company mission be front and center to your efforts of evolving the product.&lt;/p&gt;

&lt;p&gt;So I would say this is the golden rule of Developer Experience:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Don‘t sacrifice UX for DX!&lt;/li&gt;
&lt;li&gt;Don‘t hurt accessibility and semantics for easy styling.&lt;/li&gt;
&lt;li&gt;Don‘t increase bundle-size to decrease build time.&lt;/li&gt;
&lt;li&gt;Don‘t ditch tests for more frequent releases.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Switching gears
&lt;/h2&gt;

&lt;p&gt;Now that we cleared the way by defending UX as the paramount aspect of our products, we can focus on &lt;strong&gt;our&lt;/strong&gt; users. When it comes to Developer Experience, &lt;strong&gt;devs are the users&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I consider mostly 5 topics as the most important towards a good DX:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Readability&lt;/li&gt;
&lt;li&gt;Extensibility&lt;/li&gt;
&lt;li&gt;Performance&lt;/li&gt;
&lt;li&gt;Accessibility&lt;/li&gt;
&lt;li&gt;Code coverage&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let’s expand on those!&lt;/p&gt;
&lt;h2&gt;
  
  
  Readability
&lt;/h2&gt;

&lt;p&gt;By transpiling/compiling our code, we‘re now past the time where we had to hand perform most code optimizations by hand. Things like implicit programming and single-letter variables should live only on production code.&lt;/p&gt;

&lt;p&gt;We are now lucky enough that we need to write our code exclusively for the humans who will later read or use it, not for the machines who will run it. Of course, to a certain degree! Be sure to write optimizable code, and always check what‘s running on production! Eluding tree-shake for example is quite an easy trap to fall through, for example.&lt;/p&gt;

&lt;p&gt;Linting and code formatters are your allies on this, if your code is consistent there‘s a bigger chance it will be more readable and it will make it easier for good patterns to erupt from it.&lt;br&gt;
The more readable a code is, the more productive and efficient newcomers will feel. This kind of perception allows for more confidence in tackling tasks and even offering input for improvements.&lt;br&gt;
I‘d also go on a limb and say: if the code is welcoming, chances are the team also is.&lt;/p&gt;
&lt;h2&gt;
  
  
  Extensibility
&lt;/h2&gt;

&lt;p&gt;I believe all of us agree that granularity and abstractions are useful tools for creating code that scales. As frontend developers, we all fell in love with modules, arrived in ES2015, or even CommonJS sometime before. And probably have been guilty of creating those 30-line files. So concise. Import everywhere and let the bundler tree-shake them later.&lt;/p&gt;

&lt;p&gt;Sorry, that was sarcasm.&lt;/p&gt;

&lt;p&gt;Abstractions and modularization are good, I'm not here to deny that. Though, as most good things in life, overuse takes a toll. &lt;/p&gt;

&lt;p&gt;Those tiny modules give us the impression our code is highly reusable. But as time goes by, new use-cases emerge. And since the abstraction is already decoupled from business rules, it‘s logical to just create a new use-case inside our abstraction. A new parameter, a new conditional. And our tiny module grows. Or worse: our application grows around it, twisting and flexing to accommodate into the abstraction proper usage. This is an allegory of the Sunk Cost Fallacy and also the foundation of AHA Programming methodology.&lt;/p&gt;

&lt;p&gt;On her article The Wrong Abstraction, Sandi Metz describes really well how a wrong abstraction can cost more for to your code maintenance than a little bit of duplication. Don‘t abstract too soon. Allow some duplicated code to live for a while until the patterns emerge. No need to take my word for it, though, Kent C Dodds said it better on his &lt;a href="https://kentcdodds.com/blog/aha-programming/" rel="noopener noreferrer"&gt;AHA Programming&lt;/a&gt; post:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;After you've got a few places where that code is running, the commonalities will scream at you for abstraction and you'll be in the right frame of mind to provide that abstraction.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For a good Developer Experience, code needs to be reusable, easily reusable. Plus, I don‘t need to remind you less code is faster than any code, right? Skip those conditionals and extra parameters by creating the right kind of abstraction.&lt;/p&gt;
&lt;h2&gt;
  
  
  Performance and Accessibility
&lt;/h2&gt;

&lt;p&gt;These two don‘t add much to Developer Experience in usual cases, but because most of us are privileged enough, it‘s easy to forget it is not a norm. And that‘s when we start overlooking the compound of cases that add up to a terrible User Experience.&lt;/p&gt;

&lt;p&gt;Remember our golden rule? &lt;strong&gt;There‘s not DX without good UX&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So, set your Accessibility tests early, define a Performance Budget sooner than later. This way, it‘s possible to ship better DX with confidence of not messing up the UX as a side-effect.&lt;/p&gt;
&lt;h2&gt;
  
  
  Coverage
&lt;/h2&gt;

&lt;p&gt;People need to confidently be able to tweak functioning parts of the code, refactor, and improve them without fear of breaking the application in production. We‘re just as good developers as the tests we write. Everybody write bugs all the time, some get caught at compile-time, some on build, others in integration, and worst case scenario: in production.&lt;/p&gt;

&lt;p&gt;There are multiple ways of assuring good coverage. The only footgun is trusting the 100% Coverage mark on your library reports. Testing units, is not testing behavior and user-interaction.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-807626710350839808-947" src="https://platform.twitter.com/embed/Tweet.html?id=807626710350839808"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-807626710350839808-947');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=807626710350839808&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;To be more specific, test what user behavior. No impossible states and no forcing weird edge-cases that won‘t really exist. Focus on how your users will interact and the bits and pieces of your code will integrate with each other. Another very good reference is the Testing Trophy (from Write Tests):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvje1d5yylt5begbt212v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvje1d5yylt5begbt212v.png" alt="Testing Trophy, by Kent C Dodds" width="518" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Making things work… well
&lt;/h2&gt;

&lt;p&gt;With proper tests and benchmarks, developers are allowed to raise the bar on the MVP (Minimum Viable Product) of whichever thing they are coding. This happens because tests will assure nothing gets left out. And benchmarks will provide actionable insight on degrading quality of the UX.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With that approach, the fallacy that Developer Experience deviates focus from User Experience and treat them as opposing forces is not only moot, but plain wrong. Better DX paves the way to actually worry about things that matter the most to the end-users.&lt;/p&gt;

&lt;p&gt;If you liked this article, please consider sharing it with your network. I‘d also love to hear what you have to say about it down in the comments or on twitter. &lt;/p&gt;

&lt;h2&gt;
  
  
  Share 💌
&lt;/h2&gt;

&lt;p&gt;In case you have found this post useful, please consider &lt;a href="https://twitter.com/intent/tweet?text=I%20enjoyed%20this%20article%20on%20@ThePracticalDev:%20https://dev.to/atila/user-experience-developer-experience-1lne%20by%20@AtilaFassina"&gt;sharing it with your network&lt;/a&gt;, that would help me a lot to continue sharing posts like this and others. 😁&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://css-tricks.com/what-is-developer-experience-dx/" rel="noopener noreferrer"&gt;What is Developer Experience (DX)?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kentcdodds.com/blog/aha-programming/" rel="noopener noreferrer"&gt;AHA Programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.sandimetz.com/blog/2016/1/20/the-wrong-abstraction" rel="noopener noreferrer"&gt;The Wrong Abstraction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Sunk_cost#Loss_aversion_and_the_sunk_cost_fallacy" rel="noopener noreferrer"&gt;Sunk Cost Fallacy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kentcdodds.com/blog/write-tests" rel="noopener noreferrer"&gt;Write Tests&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Thanks
&lt;/h2&gt;

&lt;p&gt;Thank you very much to &lt;a href="https://twitter.com/GirlsCodeMK" rel="noopener noreferrer"&gt;Eva Dee&lt;/a&gt; for reviewing this post and giving the final nudge to actually publishing it! 🚀&lt;/p&gt;




&lt;p&gt;Cover photo by &lt;a href="https://unsplash.com/photos/pqHRNS8Mojc" rel="noopener noreferrer"&gt;Pascal Habermann on Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devrel</category>
      <category>ux</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Searching topic suggestions for TypeScript screencast</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Fri, 29 May 2020 11:11:46 +0000</pubDate>
      <link>https://dev.to/atila/searching-topic-suggestions-for-typescript-screencast-3c4h</link>
      <guid>https://dev.to/atila/searching-topic-suggestions-for-typescript-screencast-3c4h</guid>
      <description>&lt;p&gt;I have a Youtube channel called &lt;a href="https://atila.io/scopeleak" rel="noopener noreferrer"&gt;Scope Leak&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;There you will find 5 minutes (aprox) screencast explaining concepts and patterns on web development. I have enjoyed very much recording TypeScript short tutorials for folks from beginner to intermediate level of acquaintance with the language.&lt;/p&gt;

&lt;p&gt;And now I want to know from &lt;strong&gt;you&lt;/strong&gt;.&lt;br&gt;
What would like to see next?&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1266284802275065861-821" src="https://platform.twitter.com/embed/Tweet.html?id=1266284802275065861"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1266284802275065861-821');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1266284802275065861&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;As I said on the tweet, any idea will take. If it’s an advanced concept, I will try my best to make it approachable to all levels! If it’s a broad topic, I will take liberty on splitting on multiple videos. I personally find 5-10min videos nicer to watch and that’s what I'm going for on &lt;a href="https://atila.io/scopeleak" rel="noopener noreferrer"&gt;Scope Leak&lt;/a&gt;, still open to suggestions though.&lt;/p&gt;

&lt;p&gt;❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓&lt;br&gt;
&lt;strong&gt;If you are/were getting into TypeScript, what kind of concept/topic would you like to have a quick walkthough on?&lt;/strong&gt;&lt;br&gt;
❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓❓&lt;/p&gt;



&lt;p&gt;My work thus far:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript Generics in under 5 minutes
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/fGco9aaNmqI"&gt;
&lt;/iframe&gt;
&lt;/li&gt;
&lt;li&gt;TypeScript Utility Types: Part #1
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/MtK0pLS0ypo"&gt;
&lt;/iframe&gt;
&lt;/li&gt;
&lt;li&gt;TypeScript Utility Types: Part #2
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/hKEErJHWZqw"&gt;
&lt;/iframe&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;📺&lt;br&gt;
You can also binge watch them in the &lt;a href="https://www.youtube.com/playlist?list=PLnf4fY6gAka0jQsSKP8MukABKSeYaPCLe" rel="noopener noreferrer"&gt;Simplified TypeScript&lt;/a&gt; playlist if that’s your thing&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Getting started with TypeScript&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/atila" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2606%2F09b9a4b1-15c2-4444-aeb6-bf7c0a0d1e03.png" alt="atila"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/atila/starting-with-typescript-5gni" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Starting with TypeScript&lt;/h2&gt;
      &lt;h3&gt;Atila Fassina ・ May 17 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#typescript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;





&lt;p&gt;Needless to say, you will help me publishing more of these if you subscribe on &lt;a href="https://atila.io/scopeleak" rel="noopener noreferrer"&gt;youtube&lt;/a&gt;, &lt;a href="https://twitter.com/atilafassina/" rel="noopener noreferrer"&gt;twitter&lt;/a&gt;, and/or &lt;a href="https://dev.to/atila"&gt;here on dev.to&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Cover Photo by &lt;a href="https://unsplash.com/photos/tSJc5U6f1M4" rel="noopener noreferrer"&gt;Daniel Kuruvilla on Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>discuss</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Performance Browser Hints</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Tue, 19 May 2020 20:32:25 +0000</pubDate>
      <link>https://dev.to/atila/performance-browser-hints-2212</link>
      <guid>https://dev.to/atila/performance-browser-hints-2212</guid>
      <description>&lt;p&gt;“Time cannot be bought. But time can be saved.”&lt;/p&gt;

&lt;p&gt;This quote may be too deep for a web development post, but it exemplifies well what performance means to User Experience (UX). The most important performance metrics revolve around the first fractions of second between the request of your application and the user interacting with it.&lt;/p&gt;

&lt;p&gt;People have built profitable businesses shaving off those little milliseconds. Others have spent considerable amount of time studying the correlation between that loading interval and direct conversions.&lt;/p&gt;

&lt;p&gt;It’s not a rumor the position your website shows in Google’s (and other search engines as well) Search Results Page (SERP) is influenced by performance.&lt;/p&gt;

&lt;p&gt;Performance not only determines a big portion of how pleasant the UX will be, but also if you’ll even get to pitch your product to that specific user. It also intertwines with accessibility, allowing limited connections to have a seamless experience is as much a business as it is an ethical concern.&lt;/p&gt;

&lt;p&gt;Besides optimizing our own code for performance, there are a couple of low hanging fruits which allow browsers to help us on the endeavor of providing fast and smooth navigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  DNS-Prefetch
&lt;/h2&gt;

&lt;p&gt;Prefetching the DNS means advising your browser a connection to that server will be sought. Therefore, the browser can antecipate the DNS lookup. This decreases the latency between server connections, which are often cause of poor perceived performance in websites.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"dns-prefetch"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.gstatic.com/"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚠️ Needless to say it should only be used for third-party requests. Your own domain will have already been resolved by the time this hint is read.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Preconnect
&lt;/h2&gt;

&lt;p&gt;Adding &lt;code&gt;rel="preconnect"&lt;/code&gt; to your &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; will advise the browser you intend to make request towards the domain in its &lt;code&gt;href&lt;/code&gt; and you would like the browser to establish a connection with that server as soon as possible. While &lt;code&gt;prefetch&lt;/code&gt; only accelerates the DNS lookup, &lt;code&gt;preconnect&lt;/code&gt; has a more significant impact:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DNS lookup (just like &lt;code&gt;prefetch&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;TCP connection establishment&lt;/li&gt;
&lt;li&gt;TLS handshake (for &lt;code&gt;https&lt;/code&gt; requests)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s worth noting that establishing multiple preconnections may and will cause a bottleneck, degrading performance instead of improving it. Therefore &lt;strong&gt;preconnect&lt;/strong&gt; is only recommended to use on the most important resource. &lt;strong&gt;Prefetch&lt;/strong&gt;, on the other hand, can be used more freely and combining the two can only help.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"dns-prefetch"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.gstatic.com/"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"preconnect"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.gstatic.com/"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Blocking Chained Requests
&lt;/h2&gt;

&lt;p&gt;Starting connections early on can only go so far. Some resources depend on others to be useful, like a font depends on a stylesheet. In the above example (&lt;code&gt;fonts.gstatic&lt;/code&gt; domain), connection starts as early as possible. But it still can present a considerable risk and bottleneck to performance.&lt;/p&gt;

&lt;p&gt;Most fonts are imported through passing a source in &lt;code&gt;@fontface&lt;/code&gt; rule, inside your CSS stylesheet. See the problem? If your CSS is an external resource, it needs to be requested, loaded, and parsed in order to even start fetching your font.&lt;/p&gt;

&lt;p&gt;And the issue goes on!&lt;/p&gt;

&lt;p&gt;To save users from poorly implemented interfaces where resources are fetched recklessly, the browser does not fetch the font as soon as it finds the &lt;code&gt;@fontface&lt;/code&gt; rule (which is usually on top). No, the browser waits until at least one element in the DOM requires that font. And &lt;em&gt;then&lt;/em&gt;, it blocks the entire rendering. Fetches the font, loads the font, parses the font, applies the styles. Now the browser can continue to build the rest of the DOM.&lt;/p&gt;

&lt;p&gt;Luckily, there is a way of telling the browser beforehand such a disruptive resource will be required.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preload
&lt;/h2&gt;

&lt;p&gt;This hint declares a fetch request within the HTML. In the Web font example above, the font resource could be linked to directly to the HTML. Eliminating the request chain.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Limit the resources to be preloaded to a bare minimum to avoid performance bottlenecks.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
  &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"preload"&lt;/span&gt;
  &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"fonts/webfont.woff2"&lt;/span&gt;
  &lt;span class="na"&gt;as=&lt;/span&gt;&lt;span class="s"&gt;"font"&lt;/span&gt;
  &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"font/woff2"&lt;/span&gt;
  &lt;span class="na"&gt;crossorigin&lt;/span&gt;
&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Preload requires a little bit more configuration than &lt;code&gt;preconnect&lt;/code&gt; and &lt;code&gt;dns-prefetch&lt;/code&gt;. For a resource to be properly loaded, it needs to have a &lt;code&gt;MIME/TYPE&lt;/code&gt;, and the &lt;code&gt;link&lt;/code&gt; tag accepts another attribute for indicating a request will be cross-origin.&lt;/p&gt;

&lt;p&gt;Two important things to remember:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Font requests are &lt;strong&gt;always&lt;/strong&gt; cross-origin, regardless where they’re hosted&lt;/li&gt;
&lt;li&gt;For a cross-origin request to work, you also need to have CORS already configured&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It is also possible to pass a &lt;code&gt;media&lt;/code&gt; attribute for responsive preloading.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"preload"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"small.png"&lt;/span&gt; &lt;span class="na"&gt;as=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt; &lt;span class="na"&gt;media=&lt;/span&gt;&lt;span class="s"&gt;"(max-width: 600px)"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"preload"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"big.png"&lt;/span&gt; &lt;span class="na"&gt;as=&lt;/span&gt;&lt;span class="s"&gt;"image"&lt;/span&gt; &lt;span class="na"&gt;media=&lt;/span&gt;&lt;span class="s"&gt;"(min-width: 601px)"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Managing on the server-side
&lt;/h2&gt;

&lt;p&gt;You can pass these and other &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; attributes as value of a &lt;strong&gt;HTTP Response Header&lt;/strong&gt; as well. The &lt;code&gt;Link&lt;/code&gt; field exists precisely for this and can be passed multiple values separated by a semi-colon.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Link: &amp;lt;https://one.example.com&amp;gt;; rel="dns-prefetch", &amp;lt;https://two.example.com&amp;gt;; rel="dns-prefetch", &amp;lt;https://three.example.com&amp;gt;; rel="preconnect"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Which other low hanging fruits are there in web performance that you would also recommend?&lt;/p&gt;




&lt;p&gt;&lt;a href="https://unsplash.com/photos/za2zAkj6YGE" rel="noopener noreferrer"&gt;Cover photo by Muhd Asyraaf on Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>webperf</category>
      <category>tutorial</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Starting with TypeScript</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Sun, 17 May 2020 13:11:48 +0000</pubDate>
      <link>https://dev.to/atila/starting-with-typescript-5gni</link>
      <guid>https://dev.to/atila/starting-with-typescript-5gni</guid>
      <description>&lt;p&gt;It all started with a conversation between my friend &lt;a href="https://twitter.com/naren_dev_" rel="noopener noreferrer"&gt;Narendran&lt;/a&gt; and I. Then, it became a twitter thread🧵.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1260885187828695041-891" src="https://platform.twitter.com/embed/Tweet.html?id=1260885187828695041"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1260885187828695041-891');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1260885187828695041&amp;amp;theme=dark"
  }



 &lt;/p&gt;

&lt;p&gt;Now, it’s time to put code out to back those points. If you’ve been interested in TypeScript but haven’t found the time to deep your toes into the water, or you simply didn’t figure it out how to start, or even so: it’s hard to convince your teammates of the tradeoffs. This post is for you!!&lt;/p&gt;

&lt;p&gt;In 4 easy-to-follow tips, I’ll remove all blockers you may have for adopting TypeScript. I’ll help you get confident with it and take out the fear of getting started. Ready? Don’t blink or you might miss it!! 😎&lt;/p&gt;
&lt;h2&gt;
  
  
  1. TypeScript without TypeScript
&lt;/h2&gt;

&lt;p&gt;The title sounds controversial, I wanted to hook you up (🎣). It’s actually quite straightforward and simple.&lt;/p&gt;

&lt;p&gt;TypeScript is compiled with &lt;code&gt;tsc&lt;/code&gt; (TypeScript Compiler), and the CLI accepts a few configurations. One of them enables &lt;code&gt;tsc&lt;/code&gt; to compile also JavaScript, that’s extremely useful for mixed codebases (third party stuff, migration stuff, etc). But it has an additional benefit which I don’t see getting much attention.&lt;/p&gt;

&lt;p&gt;When you allow your TypeScript Compiler to read/parse your JavaScript code, it also checks its types.&lt;/p&gt;
&lt;h3&gt;
  
  
  But, how? 🦆
&lt;/h3&gt;

&lt;p&gt;The answer for that is &lt;strong&gt;Duck Typing&lt;/strong&gt;, you can skip this section if you’re familiar with the term.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If it walks like duck, talks like a duck, quacks like a duck. Then it must be a duck!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;TypeScript compiler is able to &lt;strong&gt;infer&lt;/strong&gt; a great amount of types straight from your code, saving you the time to annotate them. Those are the types your JavaScript can be checked against. So, it’s not as complete as full-fledged TypeScript, but it gives you a good start to progressively adopt the language is your familiarity and comfort grow.&lt;/p&gt;
&lt;h3&gt;
  
  
  Adding the proper config
&lt;/h3&gt;

&lt;p&gt;I believe it goes without saying that you still need to have &lt;code&gt;typescript&lt;/code&gt; in your machine for this approach to work. Even if you’re not using the &lt;code&gt;.ts(x)&lt;/code&gt; extensions, the compiler still needs to come from somewhere.&lt;/p&gt;

&lt;p&gt;Create in the root of your project a &lt;code&gt;tsconfig.json&lt;/code&gt;. The bare minimum config you need to have is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"es5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lib"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"es2019"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dom"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy paste this and you’re good to go for some client-side code. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;❗️Note:&lt;br&gt;
I recommend using it with &lt;a href="https://parceljs.org/" rel="noopener noreferrer"&gt;parcel&lt;/a&gt;, it’s a zero-config, very fast bundler. It takes a bunch of the annoying best practices automation from your hands and allow you to focus on what matters: your app. Perfect for small projects (and perhaps even some big ones).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  2. &lt;code&gt;any&lt;/code&gt; can be a friend
&lt;/h2&gt;

&lt;p&gt;The first commandment of TypeScript is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thou shall not use of &lt;code&gt;any&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But in all honesty, I don’t really think this applies to beginners (or even in some advanced cases. Let’s save that for a future post, though).&lt;/p&gt;

&lt;p&gt;Why is &lt;code&gt;any&lt;/code&gt; so terrible?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;any&lt;/code&gt; is a type value, as you may have assumed: it says that &lt;em&gt;any type value&lt;/em&gt; can be assigned to that given key. So, whenever you use &lt;code&gt;any&lt;/code&gt;, you’re buying your way out of TypeScript. No more warnings, everything goes. And that’s bad if you look at the specific unit your working on, but it’s even worse if you look at the broad perspective.&lt;/p&gt;

&lt;p&gt;An application is as reliable as its least reliable piece. So, a single use of &lt;code&gt;any&lt;/code&gt; can compromise type-safety for your entire app. Be aware of that.&lt;/p&gt;

&lt;p&gt;So, why the heck should I use it?&lt;/p&gt;

&lt;p&gt;For once: &lt;em&gt;can&lt;/em&gt; compromise. For numerous possible reasons, sometimes we are confronted with types that are really (really!) hard to declare. These types will eat your time and motivation up if you’re just starting. No one enjoys having a broken build for hours when you know your code works. In these cases, slap an &lt;code&gt;any&lt;/code&gt; there, get your task done and come back later with a fresh head.&lt;/p&gt;

&lt;p&gt;In a nutshell: use &lt;code&gt;any&lt;/code&gt;, but accepts it’s a &lt;em&gt;technical debt&lt;/em&gt; for any (pun intended) TypeScript codebase, and be sure to proper evaluate the risk before shipping code to production like that.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Pick only the right battles
&lt;/h2&gt;

&lt;p&gt;This section is actually a follow-up from the previous. But integration is a beast of its own (&lt;em&gt;in my opinion&lt;/em&gt;) when it comes to TypeScript. Strong-typing code you have no control over is specially tough. Nowadays, many many libraries and frameworks are migrating (or already have) their core to TypeScript. Which is awesome, simply by adding TS to your project you get autocompletion and self-documenting as a big welcome gift.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1260888049958838272-474" src="https://platform.twitter.com/embed/Tweet.html?id=1260888049958838272"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1260888049958838272-474');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1260888049958838272&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;But in other cases, you may want to refrain from that and strong-type your own code first. Which also smoothly brings us to the last point.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Community has your back
&lt;/h2&gt;

&lt;p&gt;As I mentioned above, many frameworks and libraries have migrated their code to TypeScript. What about the ones which didn’t?&lt;/p&gt;

&lt;p&gt;No worries, you won’t need to single-handedly strong-type your dependencies in order to migrate fully into TypeScript. 😅&lt;/p&gt;

&lt;p&gt;&lt;a href="http://definitelytyped.org/" rel="noopener noreferrer"&gt;DefinitelyTyped&lt;/a&gt; is an open-source repository maintained by the community with virtually every type you may need for other open-sourced projects. You’re a few npm searches away from strong-typing your dependencies.&lt;/p&gt;

&lt;p&gt;Seriously! Community 👏 has 👏 your 👏 back!!&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Bonus
&lt;/h2&gt;

&lt;p&gt;If you want another gentle nudge into getting started with TypeScript, &lt;a href="https://atila.io/scopeleak" rel="noopener noreferrer"&gt;Scope Leak&lt;/a&gt; has a playlist called Simplified TypeScript where I take more complex aspects of TypeScript and simplify them in byte-sized videos for you to hit the ground running!&lt;/p&gt;

&lt;p&gt;Really, 5 minutes tops, give it a try!! 🔥&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/MtK0pLS0ypo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;I’m eager for feedback and suggestions for the next videos!!&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Which other tips and tricks would suggest someone who’s about to adopt TypeScript in either a new or existing project? Have I forgot anything?&lt;/p&gt;

&lt;p&gt;Did you use any of the tips above? How did it work for you?&lt;/p&gt;

&lt;p&gt;Let me know in the comments or reach out on twitter &lt;a href="https://twitter.com/atilafassina" rel="noopener noreferrer"&gt;@AtilaFassina&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://unsplash.com/photos/wmw4iuN9pmc" rel="noopener noreferrer"&gt;Cover picture by James Lee&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Array Cheatsheet</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Wed, 13 May 2020 18:57:26 +0000</pubDate>
      <link>https://dev.to/atila/array-cheatsheet-4me0</link>
      <guid>https://dev.to/atila/array-cheatsheet-4me0</guid>
      <description>&lt;p&gt;A few days ago I came across a very nice post from Emma Bostian, a &lt;a href="https://dev.to/emmabostian/regex-cheat-sheet-2j2a"&gt;RegExp Cheatsheet&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;And that post looked so useful at the time that it got me inspired to do something similar. So I picked arrays. Here is a small selection of methods which I believe if you keep them at hand, you’ll be a more productive JavaScript developer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;flat&lt;/li&gt;
&lt;li&gt;flatMap&lt;/li&gt;
&lt;li&gt;every&lt;/li&gt;
&lt;li&gt;some&lt;/li&gt;
&lt;li&gt;reduceRight&lt;/li&gt;
&lt;li&gt;unshift&lt;/li&gt;
&lt;li&gt;slice&lt;/li&gt;
&lt;li&gt;sort&lt;/li&gt;
&lt;li&gt;from&lt;/li&gt;
&lt;li&gt;copyWithin&lt;/li&gt;
&lt;li&gt;lastIndexOf&lt;/li&gt;
&lt;li&gt;find&lt;/li&gt;
&lt;li&gt;findIndex&lt;/li&gt;
&lt;li&gt;Breaking out of Loops&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id="flat"&gt;flat&lt;/h2&gt;

&lt;p&gt;Reduce the number of layers in 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;bigArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;33&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;109&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;oneLess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;bigArray&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;flat&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;// [22, 33, 55, [23, 11], 50, 100, 109]&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;allGone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;bigArray&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;flat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;Infinity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// [22, 33, 55, 23, 11, 50, 100, 109]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It accepts one param &lt;code&gt;depth: number&lt;/code&gt;, which specifies the number of layers you to remove. Default is &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚡️ Check this video on &lt;code&gt;Array.flat()&lt;/code&gt; in less than a minute!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/74FqzrNalmY"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2 id="flatMap"&gt;flatMap&lt;/h2&gt;

&lt;p&gt;Opposed to the name suggests, &lt;code&gt;flatMap()&lt;/code&gt; is the same as &lt;code&gt;map().flat(1)&lt;/code&gt;, not the other way around.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🚨 Notice the &lt;strong&gt;1&lt;/strong&gt; to &lt;code&gt;flat()&lt;/code&gt;.&lt;br&gt;
  &lt;code&gt;flatMap&lt;/code&gt; &lt;strong&gt;always&lt;/strong&gt; runs with a &lt;code&gt;depth&lt;/code&gt; of 1.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because &lt;code&gt;flatMap&lt;/code&gt; removes empty arrays, the output array does not need to have the same &lt;code&gt;length&lt;/code&gt; as the original.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mutants&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="s1"&gt;Wolverine&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="s1"&gt;Storm&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="s1"&gt;Jubilee&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="s1"&gt;Cyclops&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;// React-like environment. JSX 👇&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;mutants&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;flatMap&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;mutant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;index&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="p"&gt;...(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;&amp;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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;, &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]),&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;mutant&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;,&lt;/span&gt;
    &lt;span class="p"&gt;])&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// Wolverine, Storm, Jubilee, Cyclops&lt;/span&gt;

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚡️ Check this video on &lt;code&gt;Array.flatMap()&lt;/code&gt; in less than a minute!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/qSnblJ9HCCo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2 id="every"&gt;every&lt;/h2&gt;

&lt;p&gt;Receives a callback in the very same way as the more popular &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt;. Though &lt;code&gt;.every()&lt;/code&gt; outputs a &lt;code&gt;boolean&lt;/code&gt; stating if &lt;strong&gt;every&lt;/strong&gt; item in the iterated &lt;code&gt;array&lt;/code&gt; matches the condition in the callback.&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;menu&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;🍔&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;big&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="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;🍕&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;big&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="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;🍜&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;medium&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hasOnlyBigMeals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;menu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;every&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;quantity&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;quantity&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;big&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// false (🍜 is 'medium')&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2 id="some"&gt;some&lt;/h2&gt;

&lt;p&gt;Receives a callback in the very same way as the more popular &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt; (and &lt;code&gt;every&lt;/code&gt; right above). In the same way as &lt;code&gt;every&lt;/code&gt;, it outputs a &lt;code&gt;boolean&lt;/code&gt; describing the matched condition in the callback. Though, &lt;code&gt;some&lt;/code&gt; returns &lt;code&gt;true&lt;/code&gt; if at least &lt;strong&gt;one&lt;/strong&gt; item in the &lt;code&gt;array&lt;/code&gt; matches the condition.&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;menu&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;🍔&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.9&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="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;🍕&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;3.9&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="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;🍜&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;8.9&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hasPricey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;menu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;price&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;price&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// true (🍔 is above 10)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚡️ Want to know more about checking your array for content? Watch this quick video about &lt;code&gt;some&lt;/code&gt;, &lt;code&gt;every&lt;/code&gt;, and &lt;code&gt;includes&lt;/code&gt;!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/hIELd6NPNQQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2 id="reduceRight"&gt;reduceRight&lt;/h2&gt;

&lt;p&gt;This one behaves exactly like the more popular &lt;code&gt;.reduce()&lt;/code&gt; with the only exception that it runs in reverse other. Reduce-RIGHT. Get it? 😅&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="s1"&gt;corgi&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="s1"&gt;beagle&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="s1"&gt;schnauzer&lt;/span&gt;&lt;span class="dl"&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="nf"&gt;reduceRight&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;acc&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="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;arr&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="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;acc&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="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;}${&lt;/span&gt;&lt;span class="nx"&gt;index&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; 🦴&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="s1"&gt;, &lt;/span&gt;&lt;span class="dl"&gt;'&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="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// schnauzer,  beagle,  corgi 🦴&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2 id="unshift"&gt;unshift&lt;/h2&gt;

&lt;p&gt;Adds an element to the beginning of the &lt;code&gt;array&lt;/code&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xmen&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="s1"&gt;Cyclops&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="s1"&gt;Jean Grey&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="s1"&gt;Storm&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="s1"&gt;Beast&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;xmen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unshift&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Wolverine&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// ['Wolverine', 'Cyclops', 'Jean Grey', 'Storm', 'Beast']&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2 id="slice"&gt;slice&lt;/h2&gt;

&lt;p&gt;Returns a &lt;strong&gt;shallow&lt;/strong&gt; copy of the passed &lt;code&gt;array&lt;/code&gt; from &lt;code&gt;start&lt;/code&gt; (defaults to first element) to &lt;code&gt;end&lt;/code&gt; (defaults to last element).&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;xmen&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="s1"&gt;Jubilee&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="s1"&gt;Kitty Pride&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="s1"&gt;Storm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="nx"&gt;xmen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&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="c1"&gt;// ['Jubilee', 'Kitty Pride']&lt;/span&gt;

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;❗Pro-tip:&lt;br&gt;
very useful for using mutating methods with Functional Programming paradigms&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id="sort"&gt;sort&lt;/h2&gt;

&lt;p&gt;arranges the items in an array at a specific order. Default is ascending. It accepts a compare function as &lt;code&gt;callback&lt;/code&gt;, first and second element are the respective params.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🚨 Careful! &lt;br&gt;
elements will be coerced into &lt;code&gt;string&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&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;numbers&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;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&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;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;//['1', '11', '4', '8']&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;numbersAgain&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;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&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;numbersAgain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&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="nx"&gt;b&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;a&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// [1, 4, 8, 11]&lt;/span&gt;

&lt;span class="nx"&gt;numbersAgain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&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="nx"&gt;b&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;b&lt;/span&gt; &lt;span class="o"&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;// [11, 8, 4, 1]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If compare function returns&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;less than 0: &lt;code&gt;a&lt;/code&gt; goes before &lt;code&gt;b&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;0: everything stays as is&lt;/li&gt;
&lt;li&gt;more than 0: &lt;code&gt;a&lt;/code&gt; goes after &lt;code&gt;b&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id="from"&gt;from&lt;/h2&gt;

&lt;p&gt;creates a new, shallow-copied Array instance from an array-like or iterable.&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;object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="c1"&gt;// it needs to have length prop here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;object&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// ['a', 'b', 'c']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2 id="copyWithin"&gt;copyWithin&lt;/h2&gt;

&lt;p&gt;copies part of an &lt;code&gt;array&lt;/code&gt; to the another location inside the &lt;strong&gt;same&lt;/strong&gt; array without altering its length.&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;array&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="s1"&gt;a&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="s1"&gt;b&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="s1"&gt;c&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="s1"&gt;d&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="s1"&gt;e&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="s1"&gt;f&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="s1"&gt;g&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="s1"&gt;h&lt;/span&gt;&lt;span class="dl"&gt;'&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="nf"&gt;copyWithin&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;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// ['a', 'e', 'f','g', 'e', 'f', 'g', 'h']&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Copy to position &lt;code&gt;1&lt;/code&gt; elements from index &lt;code&gt;4&lt;/code&gt; to &lt;code&gt;7&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id="lastIndexOf"&gt;lastIndexOf&lt;/h2&gt;

&lt;p&gt;returns the last possible index of an item in an &lt;code&gt;array&lt;/code&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xmen&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="s1"&gt;J.Madrox&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="s1"&gt;Jubilee&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="s1"&gt;J.Madrox&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="s1"&gt;Wolverine&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="s1"&gt;J.Madrox&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="nx"&gt;xmen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lastIndexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;J.Madrox&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// 4&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2 id="find"&gt;find&lt;/h2&gt;

&lt;p&gt;scans the &lt;code&gt;array&lt;/code&gt; and returns the first element which satisfies the callback.&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;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;65&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;39&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;44&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;multiple3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;item&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="c1"&gt;// 39&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2 id="findIndex"&gt;find Index&lt;/h2&gt;

&lt;p&gt;scans the &lt;code&gt;array&lt;/code&gt; and returns the &lt;code&gt;index&lt;/code&gt; of the first element which satisfies the callback.&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;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;65&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;39&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;44&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;multiple3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;item&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="c1"&gt;// 2&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2 id="breakout"&gt;Breakout of loops&lt;/h2&gt;

&lt;p&gt;it isn’t exactly trivial to stop a loop. In order to accomplish that, you need to mutate the array upon which the loop is happening, but you wouldn’t want to mutate when dealing with immutable data (like with the functional methods: map, reduce, filter, flat, flatMap, ...). &lt;/p&gt;

&lt;p&gt;Remember slice? Slice returns a subarray of the one it’s passed. We do that before we start, this means loop’s running on a shallow copy of the &lt;code&gt;array&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To break out then, it’s just about using &lt;code&gt;.splice()&lt;/code&gt;. Splice removes or &lt;br&gt;
replace elements in an &lt;code&gt;array&lt;/code&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bigArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;fill&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;contentSum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;bigArray&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&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="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;acc&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="nx"&gt;index&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;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&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="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&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;index&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;0&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;p&gt;What other methods would include in this list? Was there one or a few that you had never came across before? Let me know in the comments!!&lt;/p&gt;

&lt;p&gt;Also, I hope you have found that useful. Please consider &lt;a href="https://twitter.com/intent/tweet?text=Array%20Cheatsheet&amp;amp;via=AtilaFassina&amp;amp;url=https://dev.to/atila/array-cheatsheet"&gt;sharing to your network&lt;/a&gt; if you did, it would mean a lot to me! If you have any feedback to me regarding this or other posts of mine, feel free to reach out in the comments or on twitter!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Digital Garden</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Tue, 05 May 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/atila/digital-garden-4ga6</link>
      <guid>https://dev.to/atila/digital-garden-4ga6</guid>
      <description>&lt;p&gt;I have decided to create screencasts. My goal is to eventually get good enough on this so I can create a couple of courses, help people level up their career, and &lt;strong&gt;learn in public&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So, it‘s only natural I start following up on people already good at it. Recently I started consuming more content from Nicolas Schürmann, Simon Vrachliotis, Tomasz Łakomy, Xiaoru "Leo" Li, and Joel Hooks. Here's why you should follow each one of them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://twitter.com/_nasch_" rel="noopener noreferrer"&gt;Nicolas&lt;/a&gt;: great guy, motivated, always helpful. He's the one who got me into this whole screencast thing (more on that on a dedicated post, there's much appreciation overdue for this guy)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://twitter.com/simonswiss" rel="noopener noreferrer"&gt;Simon&lt;/a&gt;: This dude is a constant wave of positivity and good mood. He's as experienced as he's motivated, always has something nice to say but never hold back on his opinions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://twitter.com/tlakomy" rel="noopener noreferrer"&gt;Tomasz&lt;/a&gt;: A prolific content producer. He's pragmatic and straight to the point without dropping his sharp sense of humour. His videos play a big influential role on my own. Also, a genuine approachable nice guy ready to help.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://twitter.com/hexrcs" rel="noopener noreferrer"&gt;Leo&lt;/a&gt;: Another great content producer. Very technical and always eager to help!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And, lastly &lt;a href="https://twitter.com/jhooks" rel="noopener noreferrer"&gt;JHooks&lt;/a&gt;, who has me inspired in start writing more. Yesterday I was watching a stream from &lt;a href="https://egghead.io/lessons/egghead-sector-the-future-of-mdx-and-digital-gardens" rel="noopener noreferrer"&gt;Party-Corgi&lt;/a&gt; on Twitch and when he was asked about the concept of &lt;a href="https://joelhooks.com/digital-garden" rel="noopener noreferrer"&gt;Digital Gardens&lt;/a&gt; it all made sense to me and I was hooked by it (pardon the pun, irresistible).&lt;/p&gt;

&lt;p&gt;🌿&lt;/p&gt;

&lt;p&gt;Digital Garden is a concept of writing for yourself. No need for extra preparation, you write your mind, you let it out. People will find it? Maybe. People will like it? Someone will. People will hate it? Who cares?!&lt;/p&gt;

&lt;p&gt;🧠💪&lt;/p&gt;

&lt;p&gt;Allow me to add another metaphor for the Gardening one: writing is an exercise for the mind. No exercise is bad, so the mere gesture of writing stuff is already beneficial, at least for yourself. At the very least you’ll get better at expressing your ideas overtime.&lt;/p&gt;

&lt;p&gt;And the best part is, there’s no telling what that &lt;em&gt;seed&lt;/em&gt; will grow towards. Maybe someone will find it later and like it and that can spark another idea that will help that person in something, like Digital Gardens did for me.&lt;/p&gt;

&lt;p&gt;And that’s it. I will be writing more from now on.&lt;/p&gt;

&lt;p&gt;📹&lt;/p&gt;

&lt;p&gt;While I have your attention, allow me to plug in my Youtube Channel: &lt;a href="https://www.youtube.com/channel/UCfCr8kE8AL0tzDPbX1KX_gg" rel="noopener noreferrer"&gt;Scope Leak&lt;/a&gt;. Built with the very same concept of a Digital Garden, byte-sized tutorials for you to level up as a Web Developer. Check this ongoing series on &lt;a href="https://www.youtube.com/playlist?list=PLnf4fY6gAka27ppbqq_WNNLInbXlZUTlB" rel="noopener noreferrer"&gt;Arrays for Efficient Developers&lt;/a&gt;. Check out the intro video:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/fUgaS_xynns"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>motivation</category>
      <category>learning</category>
      <category>career</category>
    </item>
    <item>
      <title>Objects for mapping</title>
      <dc:creator>Atila Fassina</dc:creator>
      <pubDate>Sun, 18 Aug 2019 00:00:00 +0000</pubDate>
      <link>https://dev.to/atila/objects-for-mapping-2g2h</link>
      <guid>https://dev.to/atila/objects-for-mapping-2g2h</guid>
      <description>&lt;p&gt;Mapping &lt;code&gt;key&lt;/code&gt; to &lt;code&gt;value&lt;/code&gt; attributes has been done the same way in JavaScript for basically its entire existence. Chances are you either wrote or read it more times that you can count:&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;dictionary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;foo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bar&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;last_update&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&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;
  
  
  Caveats of Objects
&lt;/h2&gt;

&lt;p&gt;Also, chances are more than once you had to transform that into an &lt;code&gt;array&lt;/code&gt; to get around. You see, objects aren't really great for mapping variables because (1) they aren't iterables. Besides the obvious difficulty of iterating through an object (&lt;code&gt;Object.entries()&lt;/code&gt;, &lt;code&gt;Object.keys()&lt;/code&gt;, &lt;code&gt;Object.values()&lt;/code&gt;), there is also an aggregated side effect of they not being iterable, you cannot check the &lt;strong&gt;size&lt;/strong&gt; or &lt;strong&gt;length&lt;/strong&gt; of an object.&lt;/p&gt;

&lt;p&gt;Another important point in some use-cases is that the developer is not able to trust the &lt;strong&gt;order&lt;/strong&gt; in which the &lt;code&gt;object&lt;/code&gt; will store its keys (at least for numeric keys, where behavior can change depending on engine).&lt;/p&gt;

&lt;h2&gt;
  
  
  Interlude: Weakmap
&lt;/h2&gt;

&lt;p&gt;A Weakmap holds a key/value reference, but holds a weak reference between them. The point of this, is to allow it to be more easily garbage collected, so if there's no other reference to the &lt;code&gt;key&lt;/code&gt;, it can be collected. This means that there's no method to retrieve size nor iterate through a &lt;strong&gt;Weakmap&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Also, it carries interesting requirements: the key cannot be of a primitive type, as a matter of fact, it &lt;strong&gt;needs&lt;/strong&gt; to be an &lt;code&gt;object&lt;/code&gt;. Though it holds a possible advantage against using an Object as a map: it holds the order of its keys.&lt;/p&gt;

&lt;p&gt;⚠️ if you plan on using a &lt;code&gt;Weakmap&lt;/code&gt;, be aware that the value of &lt;code&gt;length&lt;/code&gt; will always be &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap#Browser_compatibility" rel="noopener noreferrer"&gt;Browser compatibility&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Map
&lt;/h2&gt;

&lt;p&gt;Differently from &lt;code&gt;object&lt;/code&gt;, a &lt;strong&gt;map object&lt;/strong&gt; preserves the insertion order of its keys. And as a counter from both &lt;code&gt;Weakmap&lt;/code&gt; which only accepts &lt;code&gt;object&lt;/code&gt; as &lt;code&gt;key&lt;/code&gt;, and &lt;code&gt;object&lt;/code&gt; which only accepts &lt;code&gt;string&lt;/code&gt; or &lt;code&gt;number&lt;/code&gt;, any primitive type can be a &lt;code&gt;key&lt;/code&gt; in a &lt;strong&gt;map&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maps&lt;/strong&gt; are not only iterables, but &lt;strong&gt;enumerables&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;myMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;foo&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="s1"&gt;bar&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="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;22&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;iterator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;entries&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;iterator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// ['foo', 'bar']&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;iterator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [0, 22]&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;size&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;// 2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get#Browser_compatibility" rel="noopener noreferrer"&gt;Browser compatibility&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://mdn.io/weakmap" rel="noopener noreferrer"&gt;WeakMap on MDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map" rel="noopener noreferrer"&gt;Map on MDN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
