<?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: Omar Adel</title>
    <description>The latest articles on DEV Community by Omar Adel (@omaradelattia).</description>
    <link>https://dev.to/omaradelattia</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%2F612680%2F7fe56079-c1d2-4de3-954e-f351c637cff8.jpg</url>
      <title>DEV Community: Omar Adel</title>
      <link>https://dev.to/omaradelattia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omaradelattia"/>
    <language>en</language>
    <item>
      <title>It works now but will it work in the future?!</title>
      <dc:creator>Omar Adel</dc:creator>
      <pubDate>Sun, 12 Mar 2023 09:19:44 +0000</pubDate>
      <link>https://dev.to/omaradelattia/it-works-now-but-will-it-work-in-the-future-1il0</link>
      <guid>https://dev.to/omaradelattia/it-works-now-but-will-it-work-in-the-future-1il0</guid>
      <description>&lt;p&gt;Have you ever run a function that works and  the tester returned it to you with a comment that it is untestable or doesn't apply to clean code concepts?&lt;/p&gt;

&lt;p&gt;while going throw some coding challenges, found concept of &lt;strong&gt;pure function&lt;/strong&gt; and &lt;strong&gt;impure function&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pure function
&lt;/h2&gt;

&lt;p&gt;In simple terms, pure functions do not have an internal state. Therefore, all operations performed in pure functions are not affected by their state. As a result, the same input parameters will give the same deterministic output regardless of how many times you run the function.&lt;/p&gt;

&lt;p&gt;To get a better understanding, let’s consider the following example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function add(a,b) { 
  return a + b
}
console.log(add(4,5))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example contains a simple add() function, which gives 9 as the output. It is a very predictable output, and it does not depend on any external code. This makes the add() function a pure function.&lt;/p&gt;

&lt;p&gt;If a function is declared pure and does not have a state, it can share many instances inside a class. Also, it is advised to avoid mutations inside pure functions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of pure functions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A pure function works as an independent function that gives the same output for the same inputs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pure functions are readable because of independent behavior. Moreover, they are straightforward to debug.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can clone an external state into a pure function, but it does not change the purity of the function.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Impure Functions
&lt;/h2&gt;

&lt;p&gt;An impure function is a function that contains one or more side effects. It mutates data outside of its lexical scope and does not predictably produce the same output for the same input.&lt;/p&gt;

&lt;p&gt;For example, consider the following code snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var addNew = 0;
function add(a,b){ 
  addNew =1; 
  return a + b + addNew
}
console.log(add(4,5))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, there is a variable named addNew, and it is declared outside of the add() function. But the state of that variable is changed inside the add() function. So, the add() function has a &lt;strong&gt;side effect&lt;/strong&gt; on a variable outside of its scope and is therefore considered an &lt;strong&gt;impure function&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In general, it’s ideal to keep the impure elements of your programs distinct from the data processing, which is usually pure. Also, updating and maintaining your applications will be much easier if you confine impure elements to their particular functions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The following JavaScript functions are inherently impure:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Math.random()&lt;/strong&gt; is an impure function since it modifies the internal state of the Math object and provides different results with each call. So Math.random() can contain side effects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;Math.random(); (Output: 0.4450692005082965)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the above code snippet, no arguments pass into any of the Math.random() function calls, but still they all produce a different result.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Date.now()&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;arr.splice()&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;arr.push()&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;arr.sort()&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;console.log()&lt;/strong&gt; and &lt;strong&gt;alert()&lt;/strong&gt; are also &lt;strong&gt;impure functions&lt;/strong&gt; (although they generate the same behavior and always return the same value for identical calls).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript is synchronous by its nature&lt;/strong&gt;. Therefore, &lt;strong&gt;asynchronous functions such as fetch and promise are impure&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Advantages of impure functions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Impure functions&lt;/strong&gt; can use an in-place solution to reduce the space complexity.&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;impure functions&lt;/strong&gt;, the state can be modified to use the parent variable and call for the function compiling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As mentioned before, the main difference between pure and impure functions in JavaScript is side effects. So, let’s discuss some specifics about the side effects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Side effects
&lt;/h2&gt;

&lt;p&gt;Side effects can occur in your program when it uses an external code block inside a function. As a result, there can be performance issues in your application. for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var preNumber =2;
function addValue(newNumber){ 
  return preNumber += newNumber; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, the variable preNumber is used inside the addValue() function. This behavior can result in the following side effects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Side effect 1: Dependency issue
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;addValue() method depends on the preNumber variable&lt;/strong&gt;. If preNumber is not defined or not available, the method will throw an error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Side effects 2: External code modification
&lt;/h2&gt;

&lt;p&gt;When the addValue() function executes, it changes the state of the preNumber variable. It shows that the &lt;strong&gt;addValue() method has a side effect of modifying external code&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Side effects 3: Non-deterministic function
&lt;/h2&gt;

&lt;p&gt;The addValue() function uses external code. &lt;strong&gt;It makes the function non-deterministic&lt;/strong&gt;, which means you cannot determine the output by looking.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pure functions&lt;/strong&gt; do not have side effects. &lt;strong&gt;Impure functions&lt;/strong&gt; can cause side effects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pure functions&lt;/strong&gt; return the same output if we use the same input parameters. However, &lt;strong&gt;impure functions&lt;/strong&gt; give different outcomes when we pass the same arguments multiple times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pure functions&lt;/strong&gt; always return some results. &lt;strong&gt;Impure functions&lt;/strong&gt; can execute without producing anything.&lt;/li&gt;
&lt;li&gt;Debugging &lt;strong&gt;pure functions&lt;/strong&gt; is relatively easier than debugging &lt;strong&gt;impure functions&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pure functions&lt;/strong&gt; cannot execute AJAX calls or standard DOM manipulation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impure functions&lt;/strong&gt; aren’t inherently wrong. They merely can cause some confusion in more extensive systems in the form of spaghetti code.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>codequality</category>
      <category>programming</category>
      <category>javascript</category>
      <category>functional</category>
    </item>
    <item>
      <title>Flexbox (Parent Properties)</title>
      <dc:creator>Omar Adel</dc:creator>
      <pubDate>Sun, 11 Dec 2022 09:03:09 +0000</pubDate>
      <link>https://dev.to/omaradelattia/flexbox-parent-properties-38jb</link>
      <guid>https://dev.to/omaradelattia/flexbox-parent-properties-38jb</guid>
      <description>&lt;p&gt;When we talk about flexbox properties we should separate between properties for parent &amp;amp; properties for children&lt;/p&gt;

&lt;h2&gt;
  
  
  Properties for the Parent
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;u&gt;&lt;strong&gt;Display&lt;/strong&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;.container {display: flex;}&lt;/code&gt; vs &lt;code&gt;.container {display: inline-flex;}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Well, both of them has the same effect on the children but the only different is on the parent. &lt;strong&gt;&lt;code&gt;flex-inline&lt;/code&gt; makes the parent display inline&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;u&gt;&lt;strong&gt;Flex-Direction&lt;/strong&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are 4 main directions which are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.container{flex-direction: row}&lt;/code&gt; (default)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;the main axis is from left to right &amp;amp; the cross axis is from top to bottom&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{flex-direction: row-reverse}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;the main axis is from right to left &amp;amp; the cross axis is from top to bottom&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{flex-direction: column}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;the main axis is from top to bottom &amp;amp; the cross axis is from left to right&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{flex-direction: column-reverse}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;the main axis is from bottom to top &amp;amp; the cross axis is from left to right&lt;/p&gt;

&lt;p&gt;But what is the main axis &amp;amp; cross axis? &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4K3hpwAW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8fwwwycsdb2ctklc59l.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4K3hpwAW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8fwwwycsdb2ctklc59l.JPG" alt="Image description" width="880" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's first understand the axis in the flexbox. Flexbox is a one dimension layout which means it apply the flex properties on only one dimension. That means we have more than one axis which are the &lt;strong&gt;main axis&lt;/strong&gt; &amp;amp; the &lt;strong&gt;cross axis&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;u&gt;&lt;strong&gt;Flex-Wrap&lt;/strong&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By default, flex items will all try to fit onto one line. We can change that and allow the items to wrap as needed with this property.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3bQwSjy0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gr1ge5tyj9qvc60j8v7y.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3bQwSjy0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gr1ge5tyj9qvc60j8v7y.PNG" alt="Image description" width="880" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.container{flex-wrap: nowrap}&lt;/code&gt; (default)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;all flex items will be on one line&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{flex-wrap: wrap}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;flex items will wrap onto multiple lines, from top to bottom.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{flex-wrap: wrap-reverse}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;flex items will wrap onto multiple lines from bottom to top.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;u&gt;&lt;strong&gt;Flex-Flow&lt;/strong&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Well, &lt;code&gt;flex-flow&lt;/code&gt; is shorthand for the flex-direction and flex-wrap properties. For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {flex-flow: column wrap;}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;u&gt;&lt;strong&gt;Justify-Content&lt;/strong&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;justify-content&lt;/code&gt; defines the alignment along the main axis so that it helps us to distribute extra free space leftover. And its types are: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uJpLVfAu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ui7p8y1ackmt3lg5k20g.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uJpLVfAu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ui7p8y1ackmt3lg5k20g.PNG" alt="Image description" width="576" height="918"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.container{justify-content: flex-start}&lt;/code&gt; (default)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are packed toward the start of the flex-direction.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{justify-content: flex-end}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are packed toward the end of the flex-direction.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{justify-content: center}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are centered along the line.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{justify-content: space-between}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are evenly distributed in the line; first item is on the start line, last item on the end line.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{justify-content: space-around}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are evenly distributed in the line with equal space around them. Note that visually the spaces aren’t equal, since all the items have equal space on both sides. The first item will have one unit of space against the container edge, but two units of space between the next item because that next item has its own spacing that applies.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{justify-content: space-evenly}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are distributed so that the spacing between any two items (and the space to the edges) is equal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{justify-content: start}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are packed toward the start of the writing-mode direction.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{justify-content: end}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are packed toward the end of the writing-mode direction.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{justify-content: left}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are packed toward left edge of the container, unless that doesn’t make sense with the flex-direction, then it behaves like start.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{justify-content: right}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are packed toward right edge of the container, unless that doesn’t make sense with the flex-direction, then it behaves like end.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;u&gt;&lt;strong&gt;Align-Items&lt;/strong&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;align-items&lt;/code&gt; defines the alignment along the cross axis so it is the same version of &lt;code&gt;justify-content&lt;/code&gt; but in diferent axis. And its types are: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BmNUDTjx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vh55bg4j6uaz5itu5l7r.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BmNUDTjx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vh55bg4j6uaz5itu5l7r.PNG" alt="Image description" width="715" height="896"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.container{align-items: stretch}&lt;/code&gt; (default)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;stretch to fill the container.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-items: flex-start | start | self-start}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are placed at the start of the cross axis. The difference between these is subtle, and is about respecting the flex-direction rules or the writing-mode rules.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-items: flex-end | end | self-end}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are placed at the end of the cross axis. The difference again is subtle and is about respecting flex-direction rules vs. writing-mode rules.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-items: center}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are centered in the cross-axis.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-items: baseline}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are aligned such as their baselines align.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;u&gt;&lt;strong&gt;Align-Content&lt;/strong&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To work with align content we should use &lt;code&gt;flex-wrap: wrap&lt;/code&gt; since it works with items in multiple lines as it is described in the photo below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a-Fe-5CX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fittw89fmwzz2fjkymj7.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a-Fe-5CX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fittw89fmwzz2fjkymj7.PNG" alt="Image description" width="685" height="897"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.container{align-content: normal}&lt;/code&gt; (default)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are packed in their default position as if no value was set.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-content: flex-start | start}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items packed to the start of the container. The (more supported) flex-start honors the flex-direction while start honors the writing-mode direction.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-content: flex-end | end}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items packed to the end of the container. The (more support) flex-end honors the flex-direction while end honors the writing-mode direction.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-content: center}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items centered in the container.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-content: space-between}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items evenly distributed; the first line is at the start of the container while the last one is at the end.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-content: space-around}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items evenly distributed with equal space around each line.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-content: space-evenly}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;items are evenly distributed with equal space around them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.container{align-content: stretch}&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;lines stretch to take up the remaining space.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;u&gt;&lt;strong&gt;Gap &amp;amp; Row-Gap &amp;amp; Column-Gap&lt;/strong&gt;&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cxzZ2V3V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n58hgtn9h6cyj4suhbhe.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cxzZ2V3V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n58hgtn9h6cyj4suhbhe.PNG" alt="Image description" width="747" height="873"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The gap property controls the space between flex items. It applies that spacing only between items not on the outer edges.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;when we apply &lt;code&gt;justify-content: space-between;&lt;/code&gt; the gap will only take effect if that space would end up smaller. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This article did not cover all the flexbox parent properties tricks but it has covered the most used ones.&lt;/p&gt;

&lt;p&gt;I hope it is helpful. And I am open to any comments or updates. &lt;/p&gt;

</description>
      <category>css</category>
      <category>flexbox</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>JavaScript Primitive &amp; Non Primitive Data Type</title>
      <dc:creator>Omar Adel</dc:creator>
      <pubDate>Thu, 11 Aug 2022 13:26:00 +0000</pubDate>
      <link>https://dev.to/omaradelattia/javascript-primitive-non-primitive-data-type-556f</link>
      <guid>https://dev.to/omaradelattia/javascript-primitive-non-primitive-data-type-556f</guid>
      <description>&lt;p&gt;Normally when we hear data types in any programming language, integer, string, etc... jumps to our mind. &lt;/p&gt;

&lt;p&gt;Although all of these things are data types, there are two umbrellas contains most of the JavaScripts data types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Primitive Data Types&lt;/strong&gt; &amp;amp; &lt;strong&gt;Non Primitive Data Types&lt;/strong&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Non Primitive Data Types
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Array&lt;/strong&gt; which is used for storing different elements, 
Ex:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arr = [1, 3, 5, 'jack']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Object&lt;/strong&gt; which is a standalone entity, with properties and type,
Ex:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;client = {
  name: "Harry Potter",
  age: 20,
  eyeColor: "blue"
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Primitive Data Types
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Number&lt;/strong&gt; which is used for floating-point numbers, 
Ex:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;String&lt;/strong&gt; which is used for sequence of characters,
Ex:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = 'Mike';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Boolean&lt;/strong&gt; which is used for logical type that can be only true or false,
Ex:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Undefined&lt;/strong&gt; which is used for a variable that got declared and yet not assigned to a value (empty value),
Ex:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;value;
console.log(value)     // undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Symbol (ES2015)&lt;/strong&gt; which is used for value that is unique &amp;amp; cannot be changed,
Ex:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;client = {
  name: "Harry Potter",
  age: 20,
  eyeColor: "blue"
};
id = Symbol('id');
client[id] = 101959; // you added an id to client named 'Harry Potter'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;BigInt (ES2020)&lt;/strong&gt; which is used for larger integers than the number type can hold,
Ex:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bigNum = BigInt("123456789012345678901234567890123456789");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;in both the array &amp;amp; the object can contain different types of data. &lt;/p&gt;
&lt;/blockquote&gt;

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