<?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: Abdullah Furkan Özbek</title>
    <description>The latest articles on DEV Community by Abdullah Furkan Özbek (@afozbek).</description>
    <link>https://dev.to/afozbek</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%2F192973%2Fecd9e350-9c36-4099-bcf9-4783e35b3a5b.jpg</url>
      <title>DEV Community: Abdullah Furkan Özbek</title>
      <link>https://dev.to/afozbek</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/afozbek"/>
    <language>en</language>
    <item>
      <title>How to add Custom Network to Metamask</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Sat, 12 Mar 2022 19:07:21 +0000</pubDate>
      <link>https://dev.to/afozbek/how-to-add-custom-network-to-metamask-l1n</link>
      <guid>https://dev.to/afozbek/how-to-add-custom-network-to-metamask-l1n</guid>
      <description>&lt;p&gt;Hello guys, this will be a post where I will show you how to add custom local network to Metamask.&lt;/p&gt;

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

&lt;blockquote&gt;
&lt;p&gt;This article assumes that you already &lt;strong&gt;installed metamask&lt;/strong&gt; and you have been &lt;strong&gt;created an account&lt;/strong&gt; before. If you don't installed yet, go to &lt;a href="https://metamask.io/" rel="noopener noreferrer"&gt;Metamask&lt;/a&gt; and download it to your browser.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Interacting with Metamask
&lt;/h2&gt;

&lt;p&gt;Click on the extension and go the settings,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fggjstcpd35n1fisiy6bp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fggjstcpd35n1fisiy6bp.png" alt="Metamask Preview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if you scroll down a little bit, you will see network option. Click on that and press add network button. This should open a form in the new tab. &lt;/p&gt;

&lt;p&gt;It should be something like this;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fc5mteuaax7gzi0fk6wd4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fc5mteuaax7gzi0fk6wd4.png" alt="Add New Network"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Custom Network
&lt;/h2&gt;

&lt;p&gt;In our tutorial, we will add custom local network to metamask. &lt;a href="https://trufflesuite.com/ganache/" rel="noopener noreferrer"&gt;Ganache&lt;/a&gt; or &lt;a href="https://hardhat.org/" rel="noopener noreferrer"&gt;Hardhat&lt;/a&gt; can be an example for that. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you want to add other EVM compatible networks, you can also do that!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Network Name&lt;/strong&gt;: Localhost:7545&lt;br&gt;
&lt;strong&gt;New RPC URL&lt;/strong&gt;: &lt;a href="http://localhost:7545" rel="noopener noreferrer"&gt;http://localhost:7545&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Chain Id&lt;/strong&gt;: 1337&lt;br&gt;
&lt;strong&gt;Currency Symbol&lt;/strong&gt;: ETH&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F68tx7wrzv8pmbegus0w4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F68tx7wrzv8pmbegus0w4.png" alt="Adding Network"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you saved that, you can see something like this;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fmbkzxnmcfyi1gzg07mec.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fmbkzxnmcfyi1gzg07mec.png" alt="Network added"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wait, whaaat! I can't see my ETH in there. Don't freak out :) It is because we do not imported our local accounts that &lt;strong&gt;node&lt;/strong&gt; gives us.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Ganache
&lt;/h2&gt;

&lt;p&gt;For this tutorial you need to install ganache in order follow along. Go to &lt;a href="https://trufflesuite.com/ganache/" rel="noopener noreferrer"&gt;Ganache&lt;/a&gt; and download the CLI.&lt;/p&gt;

&lt;p&gt;After you installed it you can run the CLI on your machine.&lt;/p&gt;

&lt;p&gt;You should see something like this;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fl211lzskgwgwixcysdah.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fl211lzskgwgwixcysdah.png" alt="Ganache CLI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click quickstart and you have everything you need.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fb8ox9kru9qnwevmbnuts.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fb8ox9kru9qnwevmbnuts.png" alt="Ganache CLI - In Depth"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Importing Accounts to Metamask
&lt;/h2&gt;

&lt;p&gt;What we need to grab the private key of one of our test accounts and import it to Metamask.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For Ganache&lt;/em&gt;, you can grab it inside it Ganache CLI, &lt;em&gt;for hardhat and other nodes&lt;/em&gt;, you can copy them right through the console once you &lt;strong&gt;start the node&lt;/strong&gt; in your terminal.&lt;/p&gt;

&lt;p&gt;Click the show keys account that is inside accounts tab. It will open a modal and you grab private key from there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fjlkpks7kldnbutk4l4nh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fjlkpks7kldnbutk4l4nh.png" alt="Ganache private key"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Do not ever use&lt;/strong&gt; test accounts in real blockchain&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.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%2F6r8sbt67g8fcnpwnxiid.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F6r8sbt67g8fcnpwnxiid.png" alt="anache Private Key Modal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy that private key and click on the Metamask extention again. Go profile &amp;gt; import account and you will see this screen;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fw2529g0ln4oio455cb6c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fw2529g0ln4oio455cb6c.png" alt="Import Account to Metamask"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and.. paste that private key to that input and click import.&lt;/p&gt;

&lt;p&gt;You should see that your active account is changed and it is labeled as imported. And you can also see that it contains test balances inside of the account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fpnti65zafr45ay4w7uaw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fpnti65zafr45ay4w7uaw.png" alt="Labeled as Imported"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great!! Now you can build your dream application and test using local nodes.&lt;/p&gt;

&lt;h2&gt;
  
  
  (Optional) - Labeling the Account
&lt;/h2&gt;

&lt;p&gt;Metamask also offers labeling the account so that if you use it for development it will be easier to differenciate them from real accounts.&lt;/p&gt;

&lt;p&gt;Once you clicked the extension again, click the three dots and go to account details.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F8t7dnri61lzhn8h4onlw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F8t7dnri61lzhn8h4onlw.png" alt="Three Dots"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This should open a modal which you see the account information&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fi5uonnyt2d7qvf8mxs5v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fi5uonnyt2d7qvf8mxs5v.png" alt="Account Info"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From there just click the pencil icon and change the name whatever you want. And save it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F9qvhexttjyp1t9168dqa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F9qvhexttjyp1t9168dqa.png" alt="Saving the Name"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you should see the updated names in myAccounts section&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fomrr3giefys9ulmbz9mu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fomrr3giefys9ulmbz9mu.png" alt="MyAccounts tab"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;And that is all from my side! Thank you so much for reading this far, and if you want to learn more topics like this feel free to subscribe &lt;a href="https://www.youtube.com/channel/UC9CYQu1fmu0hs29_6BjxLSw/videos?sub_confirmation=1" rel="noopener noreferrer"&gt;my youtube channel&lt;/a&gt; which I started last week!&lt;/p&gt;

&lt;p&gt;That's all and have a wonderful day :)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://twitter.com/afozbek_" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UC9CYQu1fmu0hs29_6BjxLSw/videos?sub_confirmation=1" rel="noopener noreferrer"&gt;Youtube&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://instagram.com/furkan.codes" rel="noopener noreferrer"&gt;Instagram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/afozbek" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>web3</category>
      <category>metamask</category>
      <category>ethereum</category>
    </item>
    <item>
      <title>React Hooks: useLayoutEffect</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Sun, 19 Sep 2021 08:42:36 +0000</pubDate>
      <link>https://dev.to/afozbek/react-hooks-uselayouteffect-42pi</link>
      <guid>https://dev.to/afozbek/react-hooks-uselayouteffect-42pi</guid>
      <description>&lt;h2&gt;
  
  
  1 - Definition
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;useLayoutEffect&lt;/strong&gt; runs &lt;strong&gt;synchronously&lt;/strong&gt; immediately after React has performed all DOM mutations. &lt;/p&gt;

&lt;p&gt;This can be useful if you need to make DOM measurements (like getting the scroll position or other styles for an element) and then make DOM mutations or trigger a synchronous re-render by updating state.&lt;/p&gt;

&lt;h2&gt;
  
  
  2 - Snytax
&lt;/h2&gt;

&lt;p&gt;It looks exactly like useEffect but different use-cases. Here is the syntax for it;&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="nx"&gt;useEffect&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="c1"&gt;// do side effects&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="cm"&gt;/* cleanup */&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;dependency&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

&lt;span class="nx"&gt;useLayoutEffect&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="c1"&gt;// do side effects&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="cm"&gt;/* cleanup */&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;dependency&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3 - useEffect vs useLayoutEffect
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;useEffect&lt;/strong&gt;&lt;br&gt;
(Component &amp;gt; State Changes &amp;gt; Component Renders &amp;gt; Rendered Component is Printed on Screen &amp;gt; useEffect runs)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;useEffect will run after React renders your component and ensures that your effect callback does not block browser painting.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;useLayoutEffect&lt;/strong&gt;&lt;br&gt;
(Component &amp;gt; State Changes &amp;gt; Component Renders &amp;gt; useLayoutEffect runs &amp;gt; Rendered Component is Printed on Screen)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;useLayoutEffect runs synchronously immediately after React has performed all DOM mutations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  4 - One Possible Example
&lt;/h2&gt;

&lt;p&gt;If your effect is mutating the DOM (via a node ref) and the DOM mutation will change the look of the DOM node between the time that it is rendered and your effect mutates it, then you want to use useLayoutEffect.&lt;/p&gt;

&lt;p&gt;Otherwise the user could see a flicker when your DOM mutations take effect. This is pretty much the only time you want to avoid useEffect and use useLayoutEffect instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  5 - Summary
&lt;/h2&gt;

&lt;p&gt;Try use useEffect most of the time, if you are really need to mutate dom directly go take a look similar examples first before applying useLayoutEffect.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;useLayoutEffect:&lt;/strong&gt; If you need to mutate the DOM and/or &lt;strong&gt;do need&lt;/strong&gt; to perform measurements&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;useEffect:&lt;/strong&gt; If you don't need to interact with the DOM at all (%99.99 of the time you will use this)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kentcdodds.com/blog/useeffect-vs-uselayouteffect"&gt;useEffect vs useLayoutEffect&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/hooks-reference.html#uselayouteffect"&gt;React useLayoutEffect&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>reactnative</category>
      <category>webdev</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>6 Tips To Achieve Your Goal</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Fri, 17 Sep 2021 16:55:48 +0000</pubDate>
      <link>https://dev.to/afozbek/6-tips-to-achive-your-goal-3jp4</link>
      <guid>https://dev.to/afozbek/6-tips-to-achive-your-goal-3jp4</guid>
      <description>&lt;h2&gt;
  
  
  1 - Define Your Goals
&lt;/h2&gt;

&lt;p&gt;The first thing you need to do is defining what you want to do to keep you motivated. It can be working full time in a developer job or learning a new language.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fwitgfry7vu2xnwk21qy9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fwitgfry7vu2xnwk21qy9.png" alt="undraw_Goals_re_lu76"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2 - Create a Schedule
&lt;/h2&gt;

&lt;p&gt;Then give which time of the day/week you can work on that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fr10t3jej1sp7xs9g8aan.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fr10t3jej1sp7xs9g8aan.png" alt="undraw_online_organizer_ofxm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3 - Start Simple
&lt;/h2&gt;

&lt;p&gt;Instead of focusing on your &lt;strong&gt;big goal&lt;/strong&gt;, divide your goal into sub-goals. This will help you to achieve them much more easily and with that way you can track your progress.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F86cza4424ujibnzfhvsc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F86cza4424ujibnzfhvsc.png" alt="undraw_Timeline_re_aw6g"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4 - Remove any Distractions
&lt;/h2&gt;

&lt;p&gt;During researching or creating projects, try to disable all notifications while working. &lt;br&gt;
Just put yourself into work mode in that time. Believe me, this can increase your productivity &lt;strong&gt;tremendously&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fz8bhu3k2ljj6g272116x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fz8bhu3k2ljj6g272116x.png" alt="undraw_Notify_re_65on"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5 - Progress Your Work
&lt;/h2&gt;

&lt;p&gt;At the end of the day, note what you have done. This will make you be proud of yourself and help you to realize how easily you can improve yourself. Maybe in the first week, you do not care much, but after that, you will see what you have done.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fqqedm30cpcgfyy6qfjip.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fqqedm30cpcgfyy6qfjip.png" alt="undraw_In_progress_re_m1l6"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6 - Share What You Have Learned
&lt;/h2&gt;

&lt;p&gt;Try to share what you have learned with others, this will make you more confident about what you have done and it will help you grow your audience in the tech community. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fpc4s1z4y8q2ejxj7q7e6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fpc4s1z4y8q2ejxj7q7e6.png" alt="undraw_pizza_sharing_wxop"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This can also be useful in interviews.&lt;/p&gt;

&lt;p&gt;You can also share pizza of course :)&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>motivation</category>
      <category>100daysofcode</category>
      <category>watercooler</category>
    </item>
    <item>
      <title>How to Deploy Your App to Netlify</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Thu, 16 Sep 2021 09:41:06 +0000</pubDate>
      <link>https://dev.to/afozbek/how-to-deploy-your-app-to-netlify-1ebi</link>
      <guid>https://dev.to/afozbek/how-to-deploy-your-app-to-netlify-1ebi</guid>
      <description>&lt;h2&gt;
  
  
  1. Push Your Code to Any Version Control Applications
&lt;/h2&gt;

&lt;p&gt;The first thing you need to do is push your git repository to any version control application. You can use any one of these;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Github&lt;/li&gt;
&lt;li&gt;Gitlab&lt;/li&gt;
&lt;li&gt;Bitbucket&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Register to Netlify
&lt;/h2&gt;

&lt;p&gt;Once you have a repository inside any given application just signup to &lt;strong&gt;Netlify&lt;/strong&gt; and connect them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F2d34mldurjuhg1m6sgvc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2d34mldurjuhg1m6sgvc.png" alt="Register"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Creating New Site
&lt;/h2&gt;

&lt;p&gt;Now, you should be on the team page where you can see your applications which right now you do not have but don't worry we'll add them right now.&lt;/p&gt;

&lt;p&gt;In there you can either click "New site from Git" button or you can visit &lt;strong&gt;&lt;a href="https://app.netlify.com/start" rel="noopener noreferrer"&gt;https://app.netlify.com/start&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You will see this screen&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F5n4gy320kooaon73tcka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F5n4gy320kooaon73tcka.png" alt="new site"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should click the button which you are storing your repository right now. In my case it is Github.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Connecting Accounts
&lt;/h2&gt;

&lt;p&gt;After that, you should see a connection screen where you will connect your Github account with Netlify.&lt;/p&gt;

&lt;p&gt;Or if you are connected you will see a text that says &lt;strong&gt;"Authorized"&lt;/strong&gt; which indicates that you already connect your account with Github****&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Choose a project
&lt;/h2&gt;

&lt;p&gt;Now select the project(repository) you want and continue&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fsmwqj4o5wc0fenzmy754.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fsmwqj4o5wc0fenzmy754.png" alt="Choose Project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Choosing Site Settings
&lt;/h2&gt;

&lt;p&gt;Now you can choose the owner of this application and choose which branch to deploy. Netlify will listen to that branch and if any changes published it will rebuild your application and run the tests for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F1zj0launei1bycfhayjx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F1zj0launei1bycfhayjx.png" alt="Site Settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also choose the build command that is needed to run to generate the build folder. This folder name can be different from framework to framework. So make sure to run on your local first to see the folder name.&lt;/p&gt;

&lt;p&gt;And once everything is ok deploy your site.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fihuvjikvrqzyghza6a77.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fihuvjikvrqzyghza6a77.png" alt="Site Settings-2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Congratulations
&lt;/h2&gt;

&lt;p&gt;Congratz! You deployed your first application to Netlify.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fnj6dumiar8pasffkkx5s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fnj6dumiar8pasffkkx5s.png" alt="Last"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>netlify</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>5 Ways To Host Your Applications</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Wed, 15 Sep 2021 07:46:38 +0000</pubDate>
      <link>https://dev.to/afozbek/5-ways-to-host-your-applications-4d77</link>
      <guid>https://dev.to/afozbek/5-ways-to-host-your-applications-4d77</guid>
      <description>&lt;h2&gt;
  
  
  1. Surge
&lt;/h2&gt;

&lt;p&gt;Surge is a cloud platform for hosting static websites, which is extremely simple to use but offers customization options for those who need them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fhho9fxkum66yyk9zxh10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fhho9fxkum66yyk9zxh10.png" alt="Surge"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Firebase
&lt;/h2&gt;

&lt;p&gt;Firebase Hosting is a fully managed hosting service for static and dynamic content as well as microservices.&lt;/p&gt;

&lt;p&gt;The service is backed by SSD storage and a global CDN (content delivery network).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F3v6uwzvh0pgc1s4chfjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F3v6uwzvh0pgc1s4chfjn.png" alt="Firebase"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Vercel
&lt;/h2&gt;

&lt;p&gt;Vercel is a hosting platform for frontend frameworks. After you create a pr it will automatically create an environment for you so that the team can check it before merging it. So useful!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fgfyqkw4t60q9n05elite.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fgfyqkw4t60q9n05elite.png" alt="Vercel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Github Pages
&lt;/h2&gt;

&lt;p&gt;GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, optionally runs the files through a build process and publishes a website&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fbzaqtfmk4u0c73ghh8x1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fbzaqtfmk4u0c73ghh8x1.png" alt="Github Pages"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Netlify is a web hosting and automation platform that accelerates &lt;strong&gt;development productivity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I deployed most of my projects to Netlify because it is so easy to use, it is supporting custom domains, and much more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fr1103jdsiispz4g15azh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fr1103jdsiispz4g15azh.png" alt="Netlify"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;You might be interested in this too&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/afozbek" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.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%2F192973%2Fecd9e350-9c36-4099-bcf9-4783e35b3a5b.jpg" alt="afozbek"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/afozbek/how-to-deploy-your-app-to-netlify-1ebi" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;How to Deploy Your App to Netlify&lt;/h2&gt;
      &lt;h3&gt;Abdullah Furkan Özbek ・ Sep 16 '21&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#netlify&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#100daysofcode&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;





&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/suhailkakar/6-ways-to-host-your-react-js-app-for-free-2163"&gt;6 Ways to Host Your React JS App For Free&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>programming</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Array methods that you should know</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Tue, 14 Sep 2021 08:02:16 +0000</pubDate>
      <link>https://dev.to/afozbek/array-methods-that-you-should-know-j0m</link>
      <guid>https://dev.to/afozbek/array-methods-that-you-should-know-j0m</guid>
      <description>&lt;h2&gt;
  
  
  1- findIndex
&lt;/h2&gt;

&lt;p&gt;The findIndex() method returns the index of the first element in the array that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test.&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;array1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;130&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;isLargeNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&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;element&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;findIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isLargeNumber&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// expected output: 3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;find() method, which returns the value of an array element, instead of its index.&lt;/li&gt;
&lt;li&gt;Returns The index of the first element in the array that passes the test. Otherwise, -1.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// EXAMPLE 1&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;isPrime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&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="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&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;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;findIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isPrime&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// -1, not found&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&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="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;findIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isPrime&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 2 (array[2] is 7)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// EXAMPLE 2&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;banana&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cantaloupe&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blueberries&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;grapefruit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;findIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruit&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;fruit&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blueberries&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 3&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruits&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="c1"&gt;// blueberries&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2- includes
&lt;/h2&gt;

&lt;p&gt;The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.&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;array1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;includes&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;// expected output: true&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cat&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;dog&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;bat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// expected output: true&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;at&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// expected output: false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;When comparing strings and characters, includes() is case-sensitive.&lt;/li&gt;
&lt;li&gt;Returns: A Boolean which is true if the value searchElement is found within the array (or the part of the array indicated by the index fromIndex, if specified).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3- isArray
&lt;/h2&gt;

&lt;p&gt;The Array.isArray() method determines whether the passed value is an Array.&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="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;  &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;foobar&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&lt;/span&gt;
&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;  &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Returns true if the value is an Array; otherwise, false.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4- Some
&lt;/h2&gt;

&lt;p&gt;The some() method tests whether at least one element in the array passes the test implemented by the provided function. It returns true if, in the array, it finds an element for which the provided function returns true; otherwise it returns false. It doesn't modify the array.&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;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// checks whether an element is even&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;even&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&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;element&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;even&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// expected output: true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Returns true if the callback function returns a truthy value for at least one element in the array. Otherwise, false.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array"&gt;MDN Docs | Array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>React Hooks: useRef</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Mon, 13 Sep 2021 18:46:52 +0000</pubDate>
      <link>https://dev.to/afozbek/react-hooks-useref-ac3</link>
      <guid>https://dev.to/afozbek/react-hooks-useref-ac3</guid>
      <description>&lt;h2&gt;
  
  
  1. Definition
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;useRef&lt;/strong&gt; is a built-in React hook that accepts one argument as the initial value and returns a reference (aka ref). &lt;/p&gt;

&lt;p&gt;A reference is an object having a special property &lt;code&gt;current&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There are two main uses of &lt;strong&gt;useRef&lt;/strong&gt;;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accessing the DOM nodes or React elements&lt;/li&gt;
&lt;li&gt;Keeping a mutable variable.
&lt;/li&gt;
&lt;/ul&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;refContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialValue&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Accessing the DOM Elements
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;This is performed in 3 steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Define the reference to access the element &lt;/li&gt;
&lt;li&gt;Assign the reference to &lt;code&gt;ref&lt;/code&gt; attribute of the element&lt;/li&gt;
&lt;li&gt;After mounting, &lt;code&gt;elementRef.current&lt;/code&gt; points to the DOM element.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is equivalent of&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="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useRef&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="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CustomTextInput&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;textInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="nx"&gt;focusTextInput&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="nx"&gt;textInput&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;focus&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;textInput&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;focusTextInput&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Focus the text input&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&amp;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;
  
  
  3. Keeping a Mutable Variable
&lt;/h2&gt;

&lt;p&gt;We have two ways of keeping data between re-renders:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In the component state&lt;/strong&gt;: Every time the state changes, the component will be re-rendered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;In an instance variable&lt;/strong&gt;: The variable will persist for the full lifetime of the component. Changes in an instance variable won’t generate a re-render.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;In functional components this would be;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In a state variable&lt;/strong&gt;: &lt;code&gt;useState&lt;/code&gt; or &lt;code&gt;useReducer&lt;/code&gt;. Updates in state variables will cause a re-render of the component.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;In a ref:&lt;/strong&gt; Equivalent to instance variables in class components. Mutating the &lt;code&gt;.current&lt;/code&gt; property won’t cause a re-render.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Updating Ref
&lt;/h2&gt;

&lt;p&gt;Updating a ref variable is a side effect therefore needs to be done inside &lt;strong&gt;useEffect or useLayoutEffect&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In React all side effect should be inside Layout Phase.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gv83C0-_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j688bomywg4obk5oygir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gv83C0-_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j688bomywg4obk5oygir.png" alt="React Lifecycle"&gt;&lt;/a&gt;&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="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useRef&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="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RenderCounter&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;counter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&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="nx"&gt;useEffect&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="c1"&gt;// Every time the component has been re-rendered,&lt;/span&gt;
    &lt;span class="c1"&gt;// the counter is incremented&lt;/span&gt;
    &lt;span class="nx"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt; 

  &lt;span class="k"&gt;return&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;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`The component has been re-rendered &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; times`&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;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;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;
  
  
  5. Summary
&lt;/h2&gt;

&lt;p&gt;The useRef Hook lets us create mutable variables inside functional components.&lt;/p&gt;

&lt;p&gt;There are three main key points that you should keep in mind when using the useRef Hook;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A ref created with useRef will be created only when the component &lt;strong&gt;has been mounted&lt;/strong&gt; and preserved for the full lifecycle.&lt;/li&gt;
&lt;li&gt;Refs can be used for accessing DOM nodes or React elements, and for storing mutable variables (like with instance variables in class components).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Updating a ref is a side effect&lt;/strong&gt; so it should be done only inside a &lt;strong&gt;useEffect (or useLayoutEffect) or inside an event handler.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://reactjs.org/docs/hooks-reference.html#useref"&gt;Hooks API Reference - React&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/trabe/react-useref-hook-b6c9d39e2022"&gt;React useRef Hook&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dmitripavlutin.com/react-useref-guide/"&gt;The Complete Guide to useRef() and Refs in React&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>reactnative</category>
      <category>webdev</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>How to Built
Accessible Web Apps</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Sat, 11 Sep 2021 13:25:47 +0000</pubDate>
      <link>https://dev.to/afozbek/how-to-built-accessible-web-apps-1e96</link>
      <guid>https://dev.to/afozbek/how-to-built-accessible-web-apps-1e96</guid>
      <description>&lt;p&gt;In this article we will take a look how to built accessible web apps. &lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Semantic HTML&lt;/li&gt;
&lt;li&gt;Keyboard Accessible&lt;/li&gt;
&lt;li&gt;Tab Order&lt;/li&gt;
&lt;li&gt;Tab Index&lt;/li&gt;
&lt;li&gt;Using Native Elements&lt;/li&gt;
&lt;li&gt;Guideline for Custom Elements&lt;/li&gt;
&lt;li&gt;Screen Readers&lt;/li&gt;
&lt;li&gt;Labels and Aria Attributes&lt;/li&gt;
&lt;li&gt;Use Libraries and polyfills&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Semantic HTML
&lt;/h2&gt;

&lt;p&gt;HTML (Hyper Text Markup Language) is exactly that: a markup language. This means that it is not only plain text, but text marked up with meaning - so called "semantics". For this, HTML offers a lot of tags, each with an inherent, unique semantic meaning. And it is absolutely crucial that those tags are used properly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1630795051989%2FljYyrmHUE.jpeg%3Fauto%3Dcompress%2Cformat%26format%3Dwebp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1630795051989%2FljYyrmHUE.jpeg%3Fauto%3Dcompress%2Cformat%26format%3Dwebp" alt="Semantic HTML"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1.1. Tags with No Meanings
&lt;/h3&gt;

&lt;p&gt;To understand the importance of proper semantics, let's first look at the exceptions: tags that indeed do not provide semantical information.&lt;/p&gt;

&lt;p&gt;There are only two tags in HTML that do not have any semantic meaning: &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;. Their purpose is to offer containers needed for visual styling. And their only difference is that &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; is a &lt;strong&gt;block element&lt;/strong&gt;, while &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; is an &lt;strong&gt;inline element&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1.2. Tags with Meanings
&lt;/h3&gt;

&lt;p&gt;Content elements are used to give meaning to content (like headings, paragraphs, or links). Marking up text using an &lt;code&gt;&amp;lt;h#&amp;gt;&lt;/code&gt; tag tells the user agent that this is not just plain text, but - in fact - a heading of a certain level!&lt;/p&gt;

&lt;p&gt;Structural elements are used to group elements on a webpage, separating them into different regions (like &lt;strong&gt;header, navigation, main, or footer&lt;/strong&gt;). They have been introduced in HTML 5.&lt;/p&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Keyboard accessible
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;All the interactive elements of your page&lt;/strong&gt; e.g. text boxes, buttons etc should be accessible by keyboard. That means you should be able to bring focus on them by using &lt;strong&gt;Tab and Shift+Tab&lt;/strong&gt; keys.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Most of the interactive elements are keyboard accessible by default, i.e. browser takes care of making them keyboard ‘focus-able’.&lt;/li&gt;
&lt;li&gt;Non interactive elements like div, span and images are not keyboard accessibly by default. This is fine because users don’t generally need to interact with them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Tab Order
&lt;/h2&gt;

&lt;p&gt;‌The order in which elements get focus is called tab-order. Developers need to take care that the interactive elements have logical tab-order. Tab order should follow the natural reading sequence i.e. top to bottom and right to left (for an &lt;strong&gt;RTL type language&lt;/strong&gt;). If your tab focus is jumping around the page unpredictably then its not going to be great experience for the users.&lt;/p&gt;

&lt;p&gt;Tab-order mainly depends on the &lt;strong&gt;dom-order,&lt;/strong&gt; i.e. the way you have written your html. Any element which is ahead in the dom tree automatically goes ahead in the tab-order.&lt;/p&gt;

&lt;p&gt;Sometimes people use css to make the element appear in an order which is different form dom-order. &lt;/p&gt;

&lt;p&gt;For Example;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- This will mess the tab-order. So no no! --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"float:right;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Right aligned link&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Link 1&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Link 2&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;‌
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Tab Index
&lt;/h2&gt;

&lt;p&gt;Recommended Usage &lt;strong&gt;0 for tab accessible&lt;/strong&gt; and &lt;strong&gt;-1 for tab unaccessible&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To make a non interactive element focusable you can give it &lt;code&gt;tabindex="0"&lt;/code&gt; attribute. This not only makes the element &lt;strong&gt;tab accessible&lt;/strong&gt; but also makes it programmatically &lt;strong&gt;focusable&lt;/strong&gt;. That means you can call &lt;strong&gt;.focus()&lt;/strong&gt; on that element.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tabindex="-1"&lt;/code&gt; will take out any interactive element from tab-order. That means you can not access it through keyboard. This is particularly useful when you want to make few links/buttons inaccessible when they are behind an overlay or transitioned out of display (e.g. hamburger menus)&lt;/li&gt;
&lt;li&gt;Positive tabindex value makes the element tab accessible and also puts the element ahead in tab-order based on the value of the attribute. But positive tabindex values are considered anti-pattern becuase it may get very confusing more than one elements have positive tabindex values. So, &lt;strong&gt;don’t&lt;/strong&gt; &lt;strong&gt;use&lt;/strong&gt; positive tabindex.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4.1. Inert Library
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;INERT&lt;/strong&gt; is a javascript library which makes part of the application focusable or unfocusable. Under the hood it adds &lt;code&gt;tabindex="0"&lt;/code&gt; or &lt;code&gt;tabindex="-1"&lt;/code&gt; to the element.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/WICG/inert/blob/master/src/inert.js" rel="noopener noreferrer"&gt;inert/inert.js at master · WICG/inert&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Use native elements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;As far as possible please use native elements for any specific purpose. That means, for example, if you need a button then just use button tag rather than making a button using divs or spans.&lt;/li&gt;
&lt;li&gt;Native interactive elements like buttons, select boxes etc have many built in accessibility features which you might miss if you are creating your own.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5.1. Native Form Elements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://nativeformelements.com/" rel="noopener noreferrer"&gt;Native Form Elements&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Guideline for custom elements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If you must create a custom element then make sure that you go through the wai-aria best practices guide: &lt;a href="https://www.w3.org/TR/wai-aria-practices-1.1/" rel="noopener noreferrer"&gt;WAI-ARIA Authoring Practices 1.1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;These guidelines tell you how the keyboard interactions should be for any element. It also has links to demo and code examples for our help.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://www.w3.org/TR/wai-aria-practices-1.1/examples/button/button.html" rel="noopener noreferrer"&gt;Button Examples&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Screen readers
&lt;/h2&gt;

&lt;p&gt;Screen readers are applications that will tell what is the current state of application. ...&lt;/p&gt;

&lt;p&gt;You should take care of this;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Many users with visual impairment rely on assistive tools like screen readers to get information on the page and to interact with page&lt;/li&gt;
&lt;li&gt;Always use &lt;strong&gt;alt attribute&lt;/strong&gt; for images. Screen readers would read out the alt text for its users who have difficulty in seeing the image.&lt;/li&gt;
&lt;li&gt;Use proper heading tags, etc for headings, because screen readers allow users to navigate within the content of page using headings.&lt;/li&gt;
&lt;li&gt;Make efficient use of semantic tags like &lt;code&gt;&amp;lt;header&amp;gt;, &amp;lt;footer&amp;gt;, &amp;lt;section&amp;gt;, &amp;lt;nav&amp;gt;&lt;/code&gt; etc because screen readers allow users to navigate within the content of page using these tags.&lt;/li&gt;
&lt;li&gt;Screen readers need to identify the interactive elements correctly so it can ask users to interact with them. For example, if you have created a button using &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; tag then screen reader will call it out as button. But if your button is something like &lt;code&gt;&amp;lt;div class="fancy button"&amp;gt;Submit&amp;lt;/div&amp;gt;&lt;/code&gt; then screen reader will call it a “&lt;strong&gt;group&lt;/strong&gt;” because div is grouping element, and user would not understand that they are supposed to interact with that element.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How HTML elements are supported by screen readers&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://thepaciellogroup.github.io/AT-browser-tests/?utm_source=html5weekly&amp;amp;utm_medium=email" rel="noopener noreferrer"&gt;HTML test file indexthepaciellogroup.github.io&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  8. &lt;strong&gt;Labels and aria attributes&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are indeed situations where standard HTML &lt;strong&gt;does not&lt;/strong&gt; provide functionalities for all the requirements developers may have for implementing modern and interactive websites. For this, the &lt;em&gt;Accessible Rich Internet Applications (ARIA)&lt;/em&gt; technical specification was introduced.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Any code written in html not only has a visual representation but also has a semantical representation called &lt;em&gt;accessibility tree&lt;/em&gt;. Accessibility tree is used by assistive tools like &lt;strong&gt;screen readers&lt;/strong&gt; to inform the user about the accessibility properties like &lt;strong&gt;type, name, state and value&lt;/strong&gt; of the element. The values of these accessibility properties are computed by browser based on the information provided in &lt;strong&gt;html code&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In above example name is computed by the tag. &lt;strong&gt;Make use of label tag wherever applicable.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use &lt;strong&gt;aria-label&lt;/strong&gt; attribute to ensure that element has a name. Suppose you have a save button which does not have a text content, then browser will not be able to compute its name. We can mention aria-label attribute to help browser compute its name.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Similarly use different aria attributes like role, &lt;strong&gt;aria-labelledby, aria-expanded, aria-checked (etc..)&lt;/strong&gt; to help browser compute accessibility properties:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.w3.org/TR/wai-aria-practices-1.1/" rel="noopener noreferrer"&gt;WAI-ARIA Authoring Practices 1.1&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  9. &lt;strong&gt;Use Libraries and polyfills&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  9.1. Axe
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://chrome.google.com/webstore/detail/axe/lhdoppojpmngadmnindnejefpokejbdd" rel="noopener noreferrer"&gt;aXe&lt;/a&gt; is an amazing tool to identify the accessibility gaps in your page. It is a chrome extension. Install it and use through chrome dev tools to analyse the accessibility of the page.&lt;/li&gt;
&lt;li&gt;Use aXe to analyse colour contrast in your page. A bad colour contrast ratio will make it difficult for few users to read the text. aXe can point out the regions of your page where the contrast does not match the &lt;a href="https://www.w3.org/TR/WCAG20/#visual-audio-contrast" rel="noopener noreferrer"&gt;WCAG guidelines&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  9.2. Chrome Accessibility Inspector
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Chrome has an experimental &lt;a href="https://www.notion.so/0a42f815878c159517a55e6652e3b23a" rel="noopener noreferrer"&gt;accessibility inspector&lt;/a&gt; in dev tools. Go to setting -&amp;gt; experiments in chrome dev tools to enable it. This tool helps by letting you know the computed accessibility properties&lt;/li&gt;
&lt;li&gt;If you want to automate the accessibility audit in your project, you can use &lt;a href="https://github.com/dequelabs/axe-core" rel="noopener noreferrer"&gt;axe-core&lt;/a&gt;. It is a node module which you can include in your build process.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  9.3. Focus Ring
&lt;/h3&gt;

&lt;p&gt;Focus-ring is the outline which gets displayed around the control when it receives focus. At times, especially with buttons, these focus rings are not very aesthetically pleasant so developers tend to disable it in css (outline:none). Mouse users wouldn’t face any issues because of this but keyboard users find it problematic because can’t figure out whether the control has focus or not. Ideally focus ring should be visible to keyboard user even if it is invisible for mouse user. &lt;/p&gt;

&lt;p&gt;Here is an awesome library;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/WICG/focus-visible" rel="noopener noreferrer"&gt;GitHub - WICG/focus-visible: Polyfill for &lt;code&gt;:focus-visible&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  Screenshots
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;vscode accessibility extention&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKboX_W41O5nFKb1m%252Fcode-accessibility-warning.jpg%3Falt%3Dmedia%26token%3D17a66e7c-a8fa-4511-9acb-d312267e4ef2" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKboX_W41O5nFKb1m%252Fcode-accessibility-warning.jpg%3Falt%3Dmedia%26token%3D17a66e7c-a8fa-4511-9acb-d312267e4ef2" alt="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKboX_W41O5nFKb1m%2Fcode-accessibility-warning.jpg?alt=media&amp;amp;token=17a66e7c-a8fa-4511-9acb-d312267e4ef2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Checking Accessibility With AXE&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKsgfGXKuJcEVsLT6%252FScreen%2520Shot%25202019-12-09%2520at%252009.18.02.png%3Falt%3Dmedia%26token%3Da6a1f323-f67a-4df5-a714-62cc20bc5bd0" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKsgfGXKuJcEVsLT6%252FScreen%2520Shot%25202019-12-09%2520at%252009.18.02.png%3Falt%3Dmedia%26token%3Da6a1f323-f67a-4df5-a714-62cc20bc5bd0" alt="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKsgfGXKuJcEVsLT6%2FScreen%20Shot%202019-12-09%20at%2009.18.02.png?alt=media&amp;amp;token=a6a1f323-f67a-4df5-a714-62cc20bc5bd0"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Checking Accessibility With AXE-2&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKsghqU1AWtwjFjtV%252FScreen%2520Shot%25202019-12-09%2520at%252009.20.42.png%3Falt%3Dmedia%26token%3Dd0e87c6b-673f-4cf1-a628-7307b9948592" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKsghqU1AWtwjFjtV%252FScreen%2520Shot%25202019-12-09%2520at%252009.20.42.png%3Falt%3Dmedia%26token%3Dd0e87c6b-673f-4cf1-a628-7307b9948592" alt="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKsghqU1AWtwjFjtV%2FScreen%20Shot%202019-12-09%20at%2009.20.42.png?alt=media&amp;amp;token=d0e87c6b-673f-4cf1-a628-7307b9948592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Checking Accessibility With Chrome Lighthouse&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKsgiL_Km-sYCvpHA%252FScreen%2520Shot%25202019-12-09%2520at%252009.21.51.png%3Falt%3Dmedia%26token%3Db2542a0f-f047-4fd9-b5d8-96689089c766" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKsgiL_Km-sYCvpHA%252FScreen%2520Shot%25202019-12-09%2520at%252009.21.51.png%3Falt%3Dmedia%26token%3Db2542a0f-f047-4fd9-b5d8-96689089c766" alt="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKsgiL_Km-sYCvpHA%2FScreen%20Shot%202019-12-09%20at%2009.21.51.png?alt=media&amp;amp;token=b2542a0f-f047-4fd9-b5d8-96689089c766"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Checking Accessibility With Chrome Lighthouse-2&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKsgjsO6871vaFsOP%252FScreen%2520Shot%25202019-12-09%2520at%252009.22.23.png%3Falt%3Dmedia%26token%3D43f698fa-3c72-480d-9d58-cfbfa4c748c0" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgblobscdn.gitbook.com%2Fassets%252F-Lpw2alDrsVYpWGBqlF_%252F-LvdK87UfJANojIUa1DN%252F-LvdKsgjsO6871vaFsOP%252FScreen%2520Shot%25202019-12-09%2520at%252009.22.23.png%3Falt%3Dmedia%26token%3D43f698fa-3c72-480d-9d58-cfbfa4c748c0" alt="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKsgjsO6871vaFsOP%2FScreen%20Shot%202019-12-09%20at%2009.22.23.png?alt=media&amp;amp;token=43f698fa-3c72-480d-9d58-cfbfa4c748c0"&gt;&lt;/a&gt;&lt;br&gt;
‌&lt;/p&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources &amp;amp; Articles
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/" rel="noopener noreferrer"&gt;Introduction to Web Accessibility&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://frontendmasters.com/books/front-end-handbook/2019/#4.14" rel="noopener noreferrer"&gt;Front-end Developer Handbook 2019 - Learn the entire JavaScript, CSS and HTML development practice!&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/@realabhijeet4u/9-tips-to-get-bare-minimum-of-web-accessibility-739899a9437c" rel="noopener noreferrer"&gt;9 tips to get bare minimum of web accessibility&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.smashingmagazine.com/2019/06/web-accessibility-context/" rel="noopener noreferrer"&gt;Web Accessibility In Context - Smashing Magazine&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/hackernoon/removing-that-ugly-focus-ring-and-keeping-it-too-6c8727fefcd2" rel="noopener noreferrer"&gt;Removing that ugly :focus ring (and keeping it too)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://24ways.org/2019/making-a-better-custom-select-element/" rel="noopener noreferrer"&gt;Making a Better Custom Select Element&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Scroll Up 🔼&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>a11y</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>6 Javascript Projects for Beginners</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Fri, 10 Sep 2021 07:33:54 +0000</pubDate>
      <link>https://dev.to/afozbek/6-javascript-projects-for-beginners-4h19</link>
      <guid>https://dev.to/afozbek/6-javascript-projects-for-beginners-4h19</guid>
      <description>&lt;h2&gt;
  
  
  1 - Weather App
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/florinpop17/app-ideas/blob/master/Projects/1-Beginner/Weather-App.md" rel="noopener noreferrer"&gt;App Description&lt;/a&gt;&lt;/p&gt;

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

&lt;h2&gt;
  
  
  2- Pomodoro Clock
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/florinpop17/app-ideas/blob/master/Projects/1-Beginner/Pomodoro-Clock.md" rel="noopener noreferrer"&gt;App Description&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://pomo.furkanozbek.com/" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fl9pegaojoizxqnrpa8l4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fl9pegaojoizxqnrpa8l4.png" alt="Pomodoro Clock"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3 - Calculator
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/florinpop17/app-ideas/blob/master/Projects/1-Beginner/Calculator-App.md" rel="noopener noreferrer"&gt;App Description&lt;/a&gt;&lt;/p&gt;

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

&lt;h2&gt;
  
  
  4 - Todo List
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/florinpop17/app-ideas/blob/master/Projects/2-Intermediate/To-Do-App.md" rel="noopener noreferrer"&gt;App Description&lt;/a&gt;&lt;br&gt;
🔗 &lt;a href="https://todo.furkanozbek.com/" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fe3wuh18k1m1xemp52ruw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fe3wuh18k1m1xemp52ruw.png" alt="Todo App"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  5 - Password Generator
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/florinpop17/app-ideas/blob/master/Projects/2-Intermediate/Password-Generator.md" rel="noopener noreferrer"&gt;App Description&lt;/a&gt;&lt;br&gt;
🔗 &lt;a href="https://afozbek-password-generator.netlify.app/" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F3mpla96c1e5oups8xpjm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F3mpla96c1e5oups8xpjm.png" alt="Password Generator"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  6 - Countdown App
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/florinpop17/app-ideas/blob/master/Projects/1-Beginner/Countdown-Timer-App.md" rel="noopener noreferrer"&gt;App Description&lt;/a&gt;&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dev.to/pauld103/javascript-coding-projects-for-beginners-3fj0"&gt;Best JavaScript coding projects for beginners! 👨🏻‍💻&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/florinpop17/app-ideas" rel="noopener noreferrer"&gt;GitHub - florinpop17/app-ideas: A Collection of application ideas which can be used to improve your coding skills.&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What is Function Composition</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Thu, 09 Sep 2021 10:10:49 +0000</pubDate>
      <link>https://dev.to/afozbek/what-is-function-composition-232i</link>
      <guid>https://dev.to/afozbek/what-is-function-composition-232i</guid>
      <description>&lt;h2&gt;
  
  
  1. What is Compose
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;In algebra&lt;/strong&gt;, function composition allows you to apply one function to the output of another function. It looks like this;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F992%2F1%2A0YgQNEzUJfIxcLLD2K2LFw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F992%2F1%2A0YgQNEzUJfIxcLLD2K2LFw.png" alt="Compose Example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also apply same thing with javascript.&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;compose&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;f&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;x&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;g&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Example
&lt;/h2&gt;

&lt;p&gt;I can tell, you are a little bit confused. Let me break it down for you;&lt;/p&gt;

&lt;p&gt;Let’s say we want to get the name of a user and uppercase it. First of all, we have to write a function that extracts the name of the user;&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;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Furkan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Cool&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// Returns -&amp;gt; String&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getUserName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&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;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
&lt;span class="nf"&gt;getUserName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// 'Furkan'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then a function that uppercases strings:&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="c1"&gt;// Accepts -&amp;gt; String&lt;/span&gt;
&lt;span class="c1"&gt;// Returns -&amp;gt; String&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;upperCase&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;string&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;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nf"&gt;upperCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Furkan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// 'FURKAN'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Notice that one function's &lt;strong&gt;return value&lt;/strong&gt; is other function's &lt;strong&gt;parameter type&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Compose function will return a function that will executes these two functions.&lt;/p&gt;

&lt;p&gt;In our example they are: &lt;code&gt;getUsername&lt;/code&gt; &amp;amp; &lt;code&gt;upperCase&lt;/code&gt;&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;compose&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;G&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;F&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;X&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;G&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;F&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;X&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;// 'X' in compose&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Furkan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Cool&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// 'F' in compose&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getUserName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&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;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;

&lt;span class="c1"&gt;// 'G' in compose&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;upperCase&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;string&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;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;// Returned function in compose&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getUserNameAndUpperCase&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;compose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;upperCase&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getUserName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// user -&amp;gt; 'X' in compose function&lt;/span&gt;
&lt;span class="nf"&gt;getUserNameAndUpperCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="c1"&gt;//'FURKAN'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Scale Problem
&lt;/h2&gt;

&lt;p&gt;The problem with this implementation of compose() is that it takes as parameters just &lt;strong&gt;N&lt;/strong&gt; functions (&lt;code&gt;upperCase&lt;/code&gt; &amp;amp; &lt;code&gt;getUserName&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Let’s suppose we want to add another function that returns the full name of the user;&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;getUserFullName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&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;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;getUserFullName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;FURKAN&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// 'FURKAN Cool'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Did you see the problem here?&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Using compose with reduceRight function
&lt;/h2&gt;

&lt;p&gt;For this case instead of giving &lt;strong&gt;N&lt;/strong&gt; functions and manually changing them, we can use the spread &lt;code&gt;syntax (...)&lt;/code&gt; and give an array of functions as an argument to &lt;strong&gt;compose function&lt;/strong&gt;.&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="c1"&gt;// reduceRight calls from right to left instead of left to right&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;compose&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;fns&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="nx"&gt;initialVal&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;fns&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;val&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;val&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;initialVal&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;reduceRight()&lt;/code&gt; method applies a function against an accumulator and each value of the array (&lt;strong&gt;from right-to-left&lt;/strong&gt;) to reduce it to a single value.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  5. Full Example
&lt;/h2&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;compose&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;fns&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="nx"&gt;initialVal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;fns&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;val&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;val&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;initialVal&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;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Furkan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Cool&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getUserName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&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;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;upperCase&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;string&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;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&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;getUserFullName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&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;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;lastName&lt;/span&gt;
&lt;span class="nf"&gt;compose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;firstFour&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;upperCase&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getUserFullName&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// 'FURKAN Cool'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Composition is really insteresting subject. Instead of unreadable nested functions, you can organize and chain your functions with each other. And it is super cool!&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;🔗 &lt;a href="https://www.freecodecamp.org/news/function-composition-in-javascript/" rel="noopener noreferrer"&gt;Function Composition in JavaScript&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🔗 &lt;a href="https://betterprogramming.pub/compose-and-pipe-in-javascript-medium-d1e1b2b21f83" rel="noopener noreferrer"&gt;Compose and Pipe in JavaScript&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🔗 &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/ReduceRight" rel="noopener noreferrer"&gt;Array.prototype.reduceRight() - JavaScript | MDN&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>computerscience</category>
      <category>webdev</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>8 Free Public APIs That you can use in side projects</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Wed, 08 Sep 2021 10:08:51 +0000</pubDate>
      <link>https://dev.to/afozbek/8-free-public-apis-that-you-can-use-in-side-projects-42p0</link>
      <guid>https://dev.to/afozbek/8-free-public-apis-that-you-can-use-in-side-projects-42p0</guid>
      <description>&lt;h3&gt;
  
  
  1. The Open Movie Database (OMDb)
&lt;/h3&gt;

&lt;p&gt;OMDb contains different kinds of movies that you can use in your projects. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auth:&lt;/strong&gt; apiKey&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Website:&lt;/strong&gt; 🔗 &lt;a href="https://www.omdbapi.com/"&gt;OMDb&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Pokemon API
&lt;/h3&gt;

&lt;p&gt;You would probably remember these amazing creatures that can do awesome stuff. What happens we can use them in our projects;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auth:&lt;/strong&gt; No&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Website:&lt;/strong&gt; 🔗 &lt;a href="http://pokeapi.co/"&gt;PokéAPI&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Rick &amp;amp; Morty API
&lt;/h3&gt;

&lt;p&gt;These two characters really taught us something. Let us honor them by using inside projects.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auth&lt;/strong&gt;: No&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Website:&lt;/strong&gt; 🔗 &lt;a href="http://rickandmortyapi.com/"&gt;The Rick and Morty API&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Nomics Cryptocurrency &amp;amp; Bitcoin API
&lt;/h3&gt;

&lt;p&gt;So you are interested in blockchain and want to build side projects with it. Nomic is the way to go.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auth:&lt;/strong&gt; apiKey&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Website:&lt;/strong&gt; 🔗 &lt;a href="https://nomics.com/docs/"&gt;Nomics CryptoCurrent API&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. DiceBear Avatar API
&lt;/h3&gt;

&lt;p&gt;If you want to generate unique, beautiful avatars you can check out diceBear's documentation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auth:&lt;/strong&gt; No&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Website:&lt;/strong&gt; 🔗 &lt;a href="https://avatars.dicebear.com/docs"&gt;Getting started | DiceBear Avatars&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Json Placeholder API
&lt;/h3&gt;

&lt;p&gt;This one is useful for filling some dummy test data to your application. It contains &lt;code&gt;/posts&lt;/code&gt;, &lt;code&gt;/comments&lt;/code&gt; queries that you can and it is completely free to use. Awesome!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auth:&lt;/strong&gt; No&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Website:&lt;/strong&gt; 🔗 &lt;a href="http://jsonplaceholder.typicode.com/"&gt;JSONPlaceholder&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. New York Tİmes
&lt;/h3&gt;

&lt;p&gt;Get the latest news around the world quickly, smoothly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auth:&lt;/strong&gt; apiKey&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Website:&lt;/strong&gt; 🔗 &lt;a href="https://developer.nytimes.com"&gt;NYTimes API&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  8. Fixer
&lt;/h3&gt;

&lt;p&gt;See the current currency rate of exchange between different currencies.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Auth:&lt;/strong&gt; apiKey&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Website:&lt;/strong&gt; 🔗 &lt;a href="https://fixer.io/"&gt;Foreign exchange rates and currency conversion API&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dev.to/pascavld/10-free-public-apis-for-developers-you-need-to-use-for-your-next-projects-39i"&gt;10 Free Public APIs for developers you need to use for your next projects&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/public-apis/public-apis#weather"&gt;GitHub - public-apis/public-apis: A collective list of free APIs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>How to flatten array using Javascript</title>
      <dc:creator>Abdullah Furkan Özbek</dc:creator>
      <pubDate>Tue, 07 Sep 2021 11:38:37 +0000</pubDate>
      <link>https://dev.to/afozbek/how-to-flatten-array-using-javascript-17kg</link>
      <guid>https://dev.to/afozbek/how-to-flatten-array-using-javascript-17kg</guid>
      <description>&lt;h2&gt;
  
  
  Problem
&lt;/h2&gt;

&lt;p&gt;So you have some nested array but need to flattened it so you use it inside your codebase. There are actually a couple of ways to do it.&lt;/p&gt;

&lt;p&gt;Here is what we are gonna take a look at;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Array.prototype.flat()&lt;/li&gt;
&lt;li&gt;Reduce and Concat Solution&lt;/li&gt;
&lt;li&gt;Recursive Solution&lt;/li&gt;
&lt;li&gt;Stack Solution&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Array.prototype.flat() Solution
&lt;/h2&gt;

&lt;p&gt;The flat() method creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Returns:&lt;/strong&gt; A new array with the sub-array elements concatenated into it.
&lt;/li&gt;
&lt;/ul&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;arr1&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]];&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;flat&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="c1"&gt;// expected output: [0, 1, 2, 3, 4]&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arr2&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[[[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]]]];&lt;/span&gt;

&lt;span class="c1"&gt;// We can also give optional depth argument to flat function&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;flat&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;// expected output: [0, 1, 2, [3, 4]]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Flat can  also work on nested arrays&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&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;// expected output: [0, 1, 2, 3, 4]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or it can remove empty spots in the array&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;arr5&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="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;5&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;arr5&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;flat&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// [1, 2, 4, 5]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Reduce and Concat Solution
&lt;/h2&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;flatten&lt;/span&gt; &lt;span class="o"&gt;=&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="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;flat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;toFlatten&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;flat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;concat&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="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;toFlatten&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
            &lt;span class="p"&gt;?&lt;/span&gt; 
            &lt;span class="nx"&gt;flatten&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;toFlatten&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
            &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;toFlatten&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;flatten&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="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;5&lt;/span&gt;&lt;span class="p"&gt;]]);&lt;/span&gt; &lt;span class="c1"&gt;// [1, 2, 3, 4, 5]&lt;/span&gt;
&lt;span class="nx"&gt;flatten&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="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="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;5&lt;/span&gt;&lt;span class="p"&gt;]]);&lt;/span&gt; &lt;span class="c1"&gt;// [1, 1.1, 2, 3, 4, 5]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Recursive Solution
&lt;/h2&gt;

&lt;p&gt;We can also apply recursive solution with the help of concat function&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;flattenArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&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="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&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;input&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;concat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;flattenArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&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="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&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;9&lt;/span&gt;&lt;span class="p"&gt;]]]]&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;flattenArray&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="c1"&gt;// ["a", 0, 1, 2, 3, 5, 6, 8, 9]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Stack Solution
&lt;/h2&gt;

&lt;p&gt;We can also solve this by the help of stack data structure&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="c1"&gt;// non recursive flatten deep using a stack&lt;/span&gt;
&lt;span class="c1"&gt;// note that depth control is hard/inefficient as we will need to tag EACH value with its own depth&lt;/span&gt;
&lt;span class="c1"&gt;// also possible w/o reversing on shift/unshift, but array OPs on the end tends to be faster&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;flatten&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&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;stack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;input&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;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// pop value from stack&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pop&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="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// push back array items, won't modify the original input&lt;/span&gt;
      &lt;span class="nx"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;next&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="c1"&gt;// reverse to restore input order&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reverse&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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]]];&lt;/span&gt;
&lt;span class="nx"&gt;flatten&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="c1"&gt;// [1, 2, 3, 4, 5, 6]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat"&gt;Array.prototype.flat() - JavaScript | MDN&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dev.to/nandkk05/flatten-an-array-using-javascript-568l"&gt;Flatten an array using javascript&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/10865025/merge-flatten-an-array-of-arrays"&gt;Merge/flatten an array of arrays&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>100daysofcode</category>
    </item>
  </channel>
</rss>
