<?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: Love Huria</title>
    <description>The latest articles on DEV Community by Love Huria (@lhuria94).</description>
    <link>https://dev.to/lhuria94</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%2F52641%2F8f03187d-7770-4029-a932-57a05d6bd71e.JPG</url>
      <title>DEV Community: Love Huria</title>
      <link>https://dev.to/lhuria94</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lhuria94"/>
    <language>en</language>
    <item>
      <title>ECMAScript - Past, Current and the future</title>
      <dc:creator>Love Huria</dc:creator>
      <pubDate>Tue, 24 Nov 2020 12:51:07 +0000</pubDate>
      <link>https://dev.to/lhuria94/ecmascript-past-current-and-the-future-4178</link>
      <guid>https://dev.to/lhuria94/ecmascript-past-current-and-the-future-4178</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;You folks probably know what is Javascript and how popular it is now, but this was not the case in its early stages, and went through so many troubles to reach where it is now. When I started writing this post, it was intended to only talk about the latest features introduced by ECMAScript but during my research; I felt that it's a little hard to directly jump to features before setting the stage. 🙂 Here you go.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;h2&gt;
  
  
  History of Javascript
&lt;/h2&gt;

&lt;p&gt;In the early days, Netscape navigator was gaining traction on the web as a competitor to NCSA Mosaic (The first popular web browser).&lt;br&gt;
It was Netscape’s vision that the web should be more dynamic along with interactive animations which led birth to a scripting language called “Mocha”. It was created by "Brendan Eich" in 1995, a language which could be embedded and parsed directly into HTML document without any need for compilation.&lt;/p&gt;

&lt;p&gt;The idea behind “Mocha” was plain and simple i.e all it had to do is be fast, dynamic, accessible to non-developers at that point in time.&lt;/p&gt;

&lt;p&gt;During the same time, Java was emerging too; but it felt too big for a simple requirement. Hence, the efforts in putting “Mocha”  on the runway were justified. And it was clear that “Java” to be used for big enterprises and complex components where “Mocha” to be used for small scripting tasks.&lt;/p&gt;

&lt;p&gt;“Mocha" was first bundled with Netscape Navigator in May 1995. After a short period of time, it was renamed “LiveScript”. Later in December 1995, after a deal was worked out between Sun and Netscape communications, it was renamed to JavaScript with a marketing strategy that fits with “Java” for small scripting tasks.&lt;/p&gt;
&lt;h2&gt;
  
  
  Evolution of ECMAScript
&lt;/h2&gt;

&lt;p&gt;During the initial phase, while Javascript was still evolving, Netscape took Javascript to “ECMA standards organization” in order to have cross-browser support and bring in some standardization which was a wise call.&lt;br&gt;
ECMA also referred to as the “European Computer manufacturers association" formed a technical committee (known as TC39) to evolve the language, and ultimately releasing the first edition in June 1997.&lt;/p&gt;
&lt;h1&gt;
  
  
  Recap (ES1 - ES6)
&lt;/h1&gt;
&lt;h2&gt;
  
  
  ECMAScript 1, 2 &amp;amp; 3 - The beginnings
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;ECMAScript 1 was the first version released as a JavaScript standard in June 1997, although there were major misses in terms of features such as exceptions, regular expressions, etc.&lt;/li&gt;
&lt;li&gt;ECMAScript 2 was released in June 1998 as a fix for inconsistencies b/w ECMA and ISO standards for JavaScript. No new changes were brought in.&lt;/li&gt;
&lt;li&gt;ECMAScript 3 was released In December 1999 and it was the most interesting one of the three, as it brought in the first major changes which were long-awaited. It spreader like fire and reached a much wider audience since it was supported by all major browsers in the market.

&lt;ul&gt;
&lt;li&gt;Exceptions along with try/catch blocks&lt;/li&gt;
&lt;li&gt;Better error handling&lt;/li&gt;
&lt;li&gt;Regular expressions&lt;/li&gt;
&lt;li&gt;New in-built functions&lt;/li&gt;
&lt;li&gt;Do-while blocks&lt;/li&gt;
&lt;li&gt;..so on&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  ECMAScript 4 - The struggles
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;As soon as the work started on ECMAScript 4 (In 1999), there was a difference of opinions started to appear. Few folks were inclined towards taking the language to large-scale development needs. And few thought that this is not what “Javascript” was intended to do which pushed the release for a while. &lt;/li&gt;
&lt;li&gt;The discussion took way longer than expected and days, months turned to years and the set of features grew bigger and bigger.&lt;/li&gt;
&lt;li&gt;At that point in time, ES4 had the following features in the scope:

&lt;ul&gt;
&lt;li&gt;Classes&lt;/li&gt;
&lt;li&gt;Interfaces&lt;/li&gt;
&lt;li&gt;Namespaces&lt;/li&gt;
&lt;li&gt;Packages&lt;/li&gt;
&lt;li&gt;Optional type annotations&lt;/li&gt;
&lt;li&gt;Optional static type checking&lt;/li&gt;
&lt;li&gt;Structural types&lt;/li&gt;
&lt;li&gt;Type definitions&lt;/li&gt;
&lt;li&gt;Multimethods&lt;/li&gt;
&lt;li&gt;Parameterized types&lt;/li&gt;
&lt;li&gt;Proper tail calls&lt;/li&gt;
&lt;li&gt;Iterators&lt;/li&gt;
&lt;li&gt;Generators&lt;/li&gt;
&lt;li&gt;Introspection&lt;/li&gt;
&lt;li&gt;Type discriminating exception handlers&lt;/li&gt;
&lt;li&gt;Constant bindings&lt;/li&gt;
&lt;li&gt;Proper block scoping&lt;/li&gt;
&lt;li&gt;Destructuring&lt;/li&gt;
&lt;li&gt;Succinct function expressions&lt;/li&gt;
&lt;li&gt;Array comprehensions&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In conclusion, ES4 took 8 years of development, and in the end, it was completely scrapped.&lt;/p&gt;
&lt;h2&gt;
  
  
  ECMAScript 5 - Rebirth
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;After the long struggles, Javascript finally made it and became the most supported version.&lt;/li&gt;
&lt;li&gt;Big giants were supporting it like Mozilla, Chrome, Opera, etc.&lt;/li&gt;
&lt;li&gt;ES5 came up with the following features:

&lt;ul&gt;
&lt;li&gt;Getter/setters&lt;/li&gt;
&lt;li&gt;trailing commas in an array and object literals&lt;/li&gt;
&lt;li&gt;Reserved words as property names&lt;/li&gt;
&lt;li&gt;New Object methods (create, defineProperty, keys, seal, freeze, getOwnPropertyNames, etc.)&lt;/li&gt;
&lt;li&gt;New Array methods (isArray, indexOf, every, some, map, filter, reduce, etc.)&lt;/li&gt;
&lt;li&gt;String.prototype.trim and property access&lt;/li&gt;
&lt;li&gt;New Date methods (toISOString, now, toJSON)&lt;/li&gt;
&lt;li&gt;Function bind&lt;/li&gt;
&lt;li&gt;JSON&lt;/li&gt;
&lt;li&gt;Immutable global objects (undefined, NaN, Infinity)&lt;/li&gt;
&lt;li&gt;Strict mode&lt;/li&gt;
&lt;li&gt;Other minor changes (parseInt ignores leading zeroes, thrown functions have proper these values, etc.)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  ECMAScript 6 - Write less do more
&lt;/h2&gt;

&lt;p&gt;ES6 brought in a completely new way of writing javascript which was pretty exciting and the code felt more readable, new syntaxes helped to do things with small chunks of code. It was a major update after ES5 which was release in 2009. ES6 was released in 2015, that’s why you may see people calling ES2015 and ES6 interchangeably.&lt;/p&gt;

&lt;p&gt;ES6 came up with the following features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let (lexical) and const (unrebindable) bindings&lt;/li&gt;
&lt;li&gt;Arrow functions (shorter anonymous functions) and lexical this (enclosing scope this)&lt;/li&gt;
&lt;li&gt;Classes (syntactic sugar on top of prototypes)&lt;/li&gt;
&lt;li&gt;Object literal improvements (computed keys, shorter method definitions, etc.)&lt;/li&gt;
&lt;li&gt;Template strings&lt;/li&gt;
&lt;li&gt;Promises&lt;/li&gt;
&lt;li&gt;Generators, iterables, iterators and for..of&lt;/li&gt;
&lt;li&gt;Default arguments for functions and the rest operator&lt;/li&gt;
&lt;li&gt;Spread syntax&lt;/li&gt;
&lt;li&gt;Destructuring&lt;/li&gt;
&lt;li&gt;Module syntax&lt;/li&gt;
&lt;li&gt;New collections (Set, Map, WeakSet, WeakMap)&lt;/li&gt;
&lt;li&gt;Proxies and Reflection&lt;/li&gt;
&lt;li&gt;Symbols&lt;/li&gt;
&lt;li&gt;Typed arrays&lt;/li&gt;
&lt;li&gt;Support for subclassing built-ins&lt;/li&gt;
&lt;li&gt;Guaranteed tail-call optimization&lt;/li&gt;
&lt;li&gt;Simpler Unicode support&lt;/li&gt;
&lt;li&gt;Binary and octal literals&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Present and the future
&lt;/h1&gt;
&lt;h2&gt;
  
  
  ECMAScript 7 (ES2016)
&lt;/h2&gt;

&lt;p&gt;After the huge gap in the release of ES4, the committee decided to release one version every year even if it's a small update starting with ES6. The idea was not to do humongous releases like ES6 rather have small ones.&lt;/p&gt;

&lt;p&gt;So, ES7 came up with only two new features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exponential operator: In addition to existing arithmetic operators (-, &lt;em&gt;, +) which already exists in Javascript; they added a new operator (&lt;/em&gt;*) called the exponential operator. What it does is raises the first operand to the power of value from the second operand.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 5 to the power of 2 i.e 25 &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;5&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="c1"&gt;// 25&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Array.prototype.includes(): This returns true if the existing array includes a passed value. As simple as that; but really handy.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;sportsList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;cricket&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;volleyball&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;hockey&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;sportsList&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="nx"&gt;sportsList&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;cricket&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  ECMAScript 8 (ES2017)
&lt;/h2&gt;

&lt;p&gt;As part of the regular update, ES8 was released in 2017, and it came up with some really cool features. So, let’s explore them together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Object.values():&lt;/code&gt; In order to iterate through objects, this is one of the cool features ES8 introduced. It helps with looping through an object with a single line of code that returns the array with the respective values.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;music&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;rock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Rock&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;heavyMetal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Heavy Metal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;classical&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Classical Music&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;jazz&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Jazz&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;music&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="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Rock&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;Heavy Metal&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;Classical Music&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;Jazz&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Object.entries():&lt;/code&gt; This one help to convert your object to array with key value pair.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;music&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;rock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Rock&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;heavyMetal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Heavy Metal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;classical&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Classical Music&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;jazz&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Jazz&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;music&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rock&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;Rock”],  [&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="nx"&gt;heavyMetal&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="nx"&gt;Heavy&lt;/span&gt; &lt;span class="nx"&gt;Metal&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;classical&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;Classical Music”],  [&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="nx"&gt;jazz&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="nx"&gt;Jazz&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Async Functions:&lt;/code&gt; Assuming that we already know what is asynchronous programming, Async functions basically work as syntactic sugar on top of promises, making it easy to read/write. So there are two parts to it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Async keyword:&lt;/code&gt; This keyword, we put in front of a function to make the complete wrapper asynchronous. It expects an await keyword to invoke the asynchronous code.
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;helloWorld&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello World&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;helloWorld&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// returns a promise&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Await keyword:&lt;/code&gt; The real advantage of using the async keyword is to combine with the await keyword. It halts your code until the promise fulfills, then ultimately coming up with the resultant and it can only be used inside an async function.
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleVersionUpdate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&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;getValueFromStore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;AsyncStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;your_key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;);
  // do you handling
  console.log(’This will trigger once we have the value from storage, i.e the promise fulfills&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;handleVersionUpdate&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;String padding:&lt;/code&gt; This is kind of similar to what we have in CSS, with some padding left and right. Likewise, we have got a function in JS that can add some padding either at the start or at the end of the string making the output having the desired length.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;padStart(targetLength, string):&lt;/code&gt; As the name suggests, it adds up the padding at the start of the string.
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;padStart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "hellohellohelloworld"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;padEnd(targetLength, string):&lt;/code&gt; This one is applied at the end of the string.
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;padEnd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;world’); // “helloworldworldworld"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Object.getOwnPropertyDescriptors():&lt;/code&gt; This is an added tool that can help to return the property descriptors of a given object. The most useful use case is for cloning an existing object thoroughly.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;world&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;world&lt;/span&gt;&lt;span class="dl"&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;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getOwnPropertyDescriptors&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&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;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;writable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;enumerable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;configurable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;World&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;writable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;enumerable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;configurable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;clone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getPrototypeOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getOwnPropertyDescriptors&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&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="nx"&gt;clone&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// {hello: "hello", world: "world"}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Trailing commas (Also called final commas):&lt;/code&gt; This update was mostly to improve the dev experience to allow trailing commas in the params list. The intention is to have a practice in a place where if we need to add a new property, we don't need to modify the last added value with a comma ending up in cleaner version control.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;car&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;bike&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="nx"&gt;truck&lt;/span&gt;&lt;span class="err"&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;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;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// [‘car’, ‘bike’, ’truck’];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  ECMAScript 9 (ES2018)
&lt;/h2&gt;

&lt;p&gt;ES9 was released in June 2018; coming up with a lesser number of features than the last two years but maintaining a consistent yearly release cycle. Without further ado, let go through them one by one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Regular Expression changes:&lt;/code&gt; In regular expressions, it takes a test method that expects a string and pattern to search against. If you have used regular expressions in the past, you may know that the dot operator is used to match a single character. But the issue we generally face is it skips line break characters like  \n, \r, etc. So it introduced:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;DotAllFlag (\s):&lt;/code&gt; This operator can be used to match line breaks.
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/Hello.World/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;World&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="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="sr"&gt;/Hello.World/&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;World&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Unicode property escapes:&lt;/code&gt; To match any unicode character/number etc, we can now use ‘\p{type}’. For example:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;40&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="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\p&lt;/span&gt;&lt;span class="sr"&gt;{Number}/u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Lookbehind Assertions:&lt;/code&gt; There are two types of assertions in this: positive and negative.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Positive (?&amp;lt;=..):&lt;/code&gt; This one says that the word must start with &lt;code&gt;%&lt;/code&gt; and replace the word with &lt;code&gt;*****&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@hello %hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;(?&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;=%&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;hello/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*****’); // "@hello %*****"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;code&gt;Negative (?&amp;lt;!..):&lt;/code&gt; This one says that the word must start with &lt;code&gt;%&lt;/code&gt; and replace the rest of words with &lt;code&gt;*****&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@hello %hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;(?&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;!%&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;hello/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;*****’); // "@***** %hello"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Named capture groups:&lt;/code&gt; In some cases, referencing a group in terms of numbers can be a bit confusing, ES9 came up with a better syntax to divide things into groups.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// How it used to be&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;(\d{4})&lt;/span&gt;&lt;span class="sr"&gt;-&lt;/span&gt;&lt;span class="se"&gt;(\d{2})&lt;/span&gt;&lt;span class="sr"&gt;-&lt;/span&gt;&lt;span class="se"&gt;(\d{2})&lt;/span&gt;&lt;span class="sr"&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;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2020-11-21&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;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;    &lt;span class="c1"&gt;// → 2020-11-21&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;match&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="c1"&gt;// → 2020&lt;/span&gt;
&lt;span class="c1"&gt;// With new syntax&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;(?&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;year&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\d{4})&lt;/span&gt;&lt;span class="sr"&gt;-&lt;/span&gt;&lt;span class="se"&gt;(?&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;month&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\d{2})&lt;/span&gt;&lt;span class="sr"&gt;-&lt;/span&gt;&lt;span class="se"&gt;(?&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;day&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\d{2})&lt;/span&gt;&lt;span class="sr"&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;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="mi"&gt;2020&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;);
console.log(match.groups);          // → {year: "2020", month: "11", day: "21"}
console.log(match.groups.year);     // → 2020
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Promise.finally:&lt;/code&gt; We used to see the promises in terms of .then and .catch, but since the ES9 release; we seem to be able to have .finally in place which executes always at the end of promise execution. This is usually helpful in case you want to do some clean up at the end of your promise call.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;xx&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="k"&gt;finally&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;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="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;am&lt;/span&gt; &lt;span class="nx"&gt;executed&lt;/span&gt; &lt;span class="nx"&gt;always&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Rest/Spread Operator:&lt;/code&gt; ES9 came up with two new operators i.e Rest and Spread operators.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Rest operator:&lt;/code&gt; This one is used for object de-structuring.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;world&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;blabla&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blah blah&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;blabla&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;rest&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;object&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;blabla&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "blah blah"&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;rest&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// {hello: "hello", world: "world"}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Spread operator:&lt;/code&gt; This helps to insert its own properties of an object into a new one. Basically combining multiple objects.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;world&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;blabla&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blah blah&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;object2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;blablaagain&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blah blah again&lt;/span&gt;&lt;span class="dl"&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;object3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;…&lt;/span&gt;&lt;span class="nx"&gt;object1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;…&lt;/span&gt;&lt;span class="nx"&gt;object2&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;object3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// {hello: "hello", world: "world", blabla: "blah blah", blablaagain: "blah blah again"}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Asynchronous Iteration:&lt;/code&gt; As Synchronous iteration was already introduced with ES6, people felt the need to have iterations possible in asynchronous as well. As they can not be iterated using for…of loop since they return promises. ES9 came up with a new for await..of the loop.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;hello&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="k"&gt;await&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;val&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;, ‘world&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;val&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;hello&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
&lt;span class="c1"&gt;// hello &lt;/span&gt;
&lt;span class="c1"&gt;// world&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ECMAScript 10 (ES2019)
&lt;/h2&gt;

&lt;p&gt;ES10 was not as big as ES6, but it did introduce some really powerful features which made our lives a bit easy. This version was released in June 2019.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Object.fromEntries():&lt;/code&gt; This one takes a list of key-value pair and transforms into an object.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blaObj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bla&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;blah&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bla2&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;blah2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;]);&lt;/span&gt; 
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromEntries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;blaObj&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;obj&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// {bla: "blah", bla2: "blah2"}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Optional Catch Binding:&lt;/code&gt; Earlier we had this parameter which had to be passed to the catch block. But now, it has been made optional.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Some error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Don't care what it is about!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Array:&lt;/code&gt; In ES10, there were a couple of additions Array bucket. Here you go:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Array.flat():&lt;/code&gt; As the name suggests, it basically helps to flat down the subarray elements as per the specified depth.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blahArray&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;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]];&lt;/span&gt;
&lt;span class="nx"&gt;blahArray&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;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// (2) ["hello", "world”]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Array.flatMap():&lt;/code&gt; This one is kind of on the same lines as flat() along with map() features. It map through the array of items and then flatten the result in one go.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blahArr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;blahArr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;flatMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;value&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="c1"&gt;// (4) [2, 4, 6, 8]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Stable Array.sort():&lt;/code&gt; Earlier, it used to have the Quicksort algorithm as a base for arrays containing more than 10 elements. But that is no longer the case, now it uses the stable TimSort algorithm.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Changes in toString():&lt;/code&gt; In ES6, when this was introduced, it used to give a string like a representation of the function in the result when run. This has been made much more cleaner now.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;Function&lt;/span&gt; &lt;span class="nx"&gt;blahFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;//do your magic here&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;blahFunction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;blahFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Hello, I'm an ordinary function&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Changes in Symbol data type:&lt;/code&gt; As we know, “Symbol” is a primitive data type and it returns a value of type “symbol” when declared. Earlier to get the symbol description, we used to use “toString”, but now we have a getter for it to access.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;symbolExample1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Symbol&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Symbol description&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;symbolExample1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//Symbol description&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;String:&lt;/code&gt; In ES10, there were few updates made to string methods as well.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;String.trimStart():&lt;/code&gt; It helps to remove whitespace from the beginning of the string. As simple as that.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blahStr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;   Hello world!   &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;blahStr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;trimStart&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// "Hello world!   "&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;String.trimEnd():&lt;/code&gt;  It helps to remove whitespace at the end of the string.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;blahStr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;trimEnd&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// "   Hello world!"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ECMAScript 11 (ES2020)
&lt;/h2&gt;

&lt;p&gt;ES11 was released this year recently, coming up with several native features as well as few other correspondings to its yearly release.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Promise.AllSettled():&lt;/code&gt; This returns a promise once all the promises passed are resolved does not matter if they were fulfilled or rejected with an array resulting in the status of each promise.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;p1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hey&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;p2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&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;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2000&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;p3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&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;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allSettled&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;p2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;p3&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;values&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="p"&gt;[{&lt;/span&gt;&lt;span class="err"&gt;…&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;…&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&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="nl"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;fulfilled&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hey&lt;/span&gt;&lt;span class="dl"&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="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rejected&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reason&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="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="nl"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;fulfilled&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;BigInt:&lt;/code&gt; Till now, the maximum number in javascript was 9007199254740991, but now we can go beyond this number using BigInt. It is done by adding “n” at the end of the string.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;biggestNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9007199254740991&lt;/span&gt;&lt;span class="nx"&gt;n&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;biggerNumberThanBefore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;BigInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;biggestNumber&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;biggerNumberThanBefore&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 9007199254740991n&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Nullish Coalescing:&lt;/code&gt; It works as a logical operator and helps us in checking if the left-hand operand is either null or undefined and returns the right-hand operand value.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;v1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="p"&gt;??&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hey there!&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;v1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "Hey there!"&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;v2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Come here first&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;Hey there!&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;v2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// "Come here first"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Dynamic Import:&lt;/code&gt; You may have used dynamic import using JS frameworks but now this feature is available natively. This means, that now we can import modules dynamically through variables in core-js.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// File 1&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="nx"&gt;blah&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;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="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Blah&lt;/span&gt; &lt;span class="nx"&gt;Blah&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// File 2&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;sayThings&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;file1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;sayThings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;blah&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Blah Blah&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;globalThis:&lt;/code&gt; In Javascript, there are different ways to access global objects which makes it a bit tricky to write code which works cross environment. So, globalThis is here to rescue us all.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// In browsers.&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;globalThis&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// window {...}&lt;/span&gt;
&lt;span class="c1"&gt;// In nodejs&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;globalThis&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Object [global] {...}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Optional chaining operator:&lt;/code&gt; This one is my personal favorite and it's really really useful when you have a long nested chain of objects and the checking is pretty much prone to error and not readable as well.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Let&lt;/span&gt; &lt;span class="nx"&gt;cricket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;Let&lt;/span&gt; &lt;span class="nx"&gt;getCricketTeam&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cricket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;teams&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Uncaught TypeError: Cannot read property ’teams' of null&lt;/span&gt;
&lt;span class="c1"&gt;// How we can make this better&lt;/span&gt;
&lt;span class="nx"&gt;Let&lt;/span&gt; &lt;span class="nx"&gt;getCricketTeam&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cricket&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;teams&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;getCricketTeam&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; It's possible that I may miss a feature or two which was introduced. However, all major features which are widely being used should be covered here.&lt;/p&gt;

&lt;h2&gt;
  
  
  ECMAScript 12 (ES2021)
&lt;/h2&gt;

&lt;p&gt;Now with ES12, there can be features that may not go till the final stage of the proposal. So, here we will discuss the features which have actually made it till Stage 4 of the proposal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Promise.any:&lt;/code&gt; This helps in returning the first fulfilled promise of the lot. In case, all of the promises were rejected; then it ends up with an error message saying all promises were rejected.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;p1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Fail&lt;/span&gt;&lt;span class="err"&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;p2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Passed&lt;/span&gt;&lt;span class="err"&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;p3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Fail&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="err"&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;aggregatedPromises&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;p2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;p3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;aggregatedPromises&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;value&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// Passed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Numeric Separators:&lt;/code&gt; We usually have a hard time read large numbers, numeric separators help with that giving us an option to separate it out by “_”.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100000000000000&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;n&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 100000000000000&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;readableN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="nx"&gt;_000_000_000_000&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;readableN&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 100000000000000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Logical operators and assignments:&lt;/code&gt; With ES12, they are trying to combine logical operators and assignment operators such as ??, || and &amp;amp;&amp;amp;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;?? Operator:&lt;/code&gt; We already covered the use-case of the null coalescing operator in this post, now this one combines with the assignment operator as well. What it does is assigns the right-hand side value of the variable to the left-hand side incase the left-hand side variable is either null or undefined.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;hello&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;helloWithValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="p"&gt;??&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;helloWithValue&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;hello&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ‘hello’&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;|| Operator:&lt;/code&gt; It is basically somewhat similar to ?? Operator but this one also works with falsy values.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&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;helloWithValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;||=&lt;/span&gt;&lt;span class="nx"&gt;helloWithValue&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;hello&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ‘hello’&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;amp;&amp;amp; Operator:&lt;/code&gt; This one assigns right hand side variable value if the left hand side value is truthy.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;et&lt;/span&gt; &lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;helloWithValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;=&lt;/span&gt;&lt;span class="nx"&gt;helloWithValue&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;hello&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ‘hello’&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;String.replaceAll:&lt;/code&gt; Early we had replace() method which used to replace only the first instance of the string; so this feature was a little too obvious required to replace all the matching strings.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;helloWorld&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello world Hello world&lt;/span&gt;&lt;span class="dl"&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;hellosOnly&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;helloWorld&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;replaceAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;world&lt;/span&gt;&lt;span class="err"&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;hellosOnly&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 'Hello Hello' &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Intl.ListFormat:&lt;/code&gt; It is an constructor for objects which formats as per the passed language code in the parameter list.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;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="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;, ‘World’];
let deObj = new Intl.ListFormat(‘de&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;short&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;conjunction&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;deObj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;format&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;// Hello und World&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Similarly, we have Intl.DateTimeFormat available which works in the same way as the list format.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's all I had!&lt;/p&gt;

&lt;h3&gt;
  
  
  Some references:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Visit Auth0 to get to know a little bit more about JS &lt;a href="https://auth0.com/blog/a-brief-history-of-javascript/"&gt;history&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Standard JS documentation, click &lt;a href="https://developer.mozilla.org/en-US/"&gt;here&lt;/a&gt; to visit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading. 😃&lt;br&gt;
Visit my blog for the original &lt;a href="https://lhuria94.github.io/ecmascript-past-present-and-future/"&gt;post&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>ecmascript</category>
      <category>webdev</category>
      <category>dev</category>
    </item>
    <item>
      <title>How to plan and execute your first mobile app using React Native</title>
      <dc:creator>Love Huria</dc:creator>
      <pubDate>Sat, 24 Oct 2020 17:08:42 +0000</pubDate>
      <link>https://dev.to/lhuria94/how-to-plan-and-execute-your-first-mobile-app-using-react-native-445c</link>
      <guid>https://dev.to/lhuria94/how-to-plan-and-execute-your-first-mobile-app-using-react-native-445c</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;To give some background, I steered a project this year which was a hell of a challenge for me. "A corporate B2B2C mobile application". In this project, I understood the meaning of contributing not only from a programming point of view but also thinking through all aspects of it i.e. planning, setting up a foundation, asking the right questions to business, identifying tools, development/deployment practices along with keeping in mind that app also needs to be delivered on time.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, I thought about penning this down, because initially, I had to do a lot of exploration, at some places I got lost as well; therefore I am optimistic that this post will help someone who’s trying to achieve the same.&lt;/p&gt;

&lt;p&gt;Before we get into the tech side of it i.e any of the groundwork; it's essential that the scope and designs are clearly communicated to Business stakeholders considering what are we going to cover in a defined time-frame.&lt;/p&gt;

&lt;h1&gt;
  
  
  Getting started with the "Discovery and Design" phase
&lt;/h1&gt;

&lt;p&gt;For any project, or to be specific mobile-application in our case; laying down different features required in the system like offline capability, barcode scanners, background streaming, user's privacy &amp;amp; standard business requirements should be discussed and sorted out in its initial phase.&lt;/p&gt;

&lt;p&gt;I have seen it happen that in the mobile world; one thing could be obvious to your stakeholder but not to you.&lt;/p&gt;

&lt;p&gt;That's what this discovery and design phase includes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Listing down requirements
&lt;/h2&gt;

&lt;p&gt;This included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the list of features we were going to deliver to the client with all possible workflows and getting their approvals on it keeping in mind any kind of change requests asked by the business during this phase.&lt;/li&gt;
&lt;li&gt;the list of devices we were going to test mentioning different resolutions, OS, etc.&lt;/li&gt;
&lt;li&gt;the list of devices that would be tested on simulators or on a real device.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Focusing on user experience
&lt;/h2&gt;

&lt;p&gt;We believed in total transparency of showcasing the designs, having weekly demos, getting feedback from the stakeholders pro-actively. These meetings were important for everyone to understand how the mobile application will look and behave like; ultimately coming to a consensus.&lt;/p&gt;

&lt;h3&gt;
  
  
  Important stakeholders who should participate during this activity
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Design Lead&lt;/li&gt;
&lt;li&gt;Technical Lead&lt;/li&gt;
&lt;li&gt;Project Managers&lt;/li&gt;
&lt;li&gt;Business stakeholders&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  NFRs
&lt;/h2&gt;

&lt;p&gt;Along with the features list and scope, we also thought about NFRs from a mobile app perspective. NFRs should also be discussed and prioritized amongst your stakeholders, there is a need sometimes to put the perspective in place; otherwise, it will be just a clone of your web application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some examples of NFR may include
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Responsiveness:&lt;/code&gt; In this case, handle any kind of interruption usually by calls, text messages, switching apps, etc, and reverting back to the same state which you were doing before the interruption without losing your progress.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Screen Adaption:&lt;/code&gt; With different mobile devices, we get various screen sizes and applications should be able to adapt to it.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Slow Connection / Handling n/w coverage:&lt;/code&gt; Here, need to take care of the slow connection, show a proper message in case the app is not able to perform certain operations.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Performance:&lt;/code&gt; This covers app startup time, quick scrolls, switching b/w operations, etc.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Security:&lt;/code&gt; This means mostly using an encrypted data store (e.g. keychain), enabling ATS for secure communication, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Get your Style-guide ready
&lt;/h2&gt;

&lt;p&gt;Once you are sorted with designs, getting them approved; the next task for the designer would be to get the style guide ready for the developers to reference. It's highly important in order to start any of the development work or strategize your components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Usual aspects of style-guide are
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Font sizes, family to be used&lt;/li&gt;
&lt;li&gt;Error/success message variations&lt;/li&gt;
&lt;li&gt;Toast messages variations&lt;/li&gt;
&lt;li&gt;Type of buttons&lt;/li&gt;
&lt;li&gt;Color palette (Branding)&lt;/li&gt;
&lt;li&gt;Form fields variations (Text, Checkbox, Radio, Switch, etc.)&lt;/li&gt;
&lt;li&gt;..so on&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Technical Phase
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Bootstrap
&lt;/h2&gt;

&lt;p&gt;What gives me the confidence to execute anything, in general, is breaking down things into smaller chunks and that is the case even with new tech or tech which I am confident with. If I have to give advice to someone on how to start a new project, I would say, sit down alone, think through and prepare a rough list of how would you want to break and execute. Define tasks and their outcomes.&lt;/p&gt;

&lt;p&gt;And this is the first step I did!! &lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up React native on local along with code versioning
&lt;/h2&gt;

&lt;p&gt;As choosing a technology or a framework was a pre-requisite, setting up React native on local made sense. You might be thinking, what’s the big deal with that. There is NOT. &lt;br&gt;
It just gives a sense of achievement we kickstarted and it's not like you are not going to need it. 😉 &lt;/p&gt;

&lt;h3&gt;
  
  
  Tasks to be done as part of setting up RN on local
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Set up a Github or Gitlab or bitbucket (Whatever you may like to use) with standard environment branches like development, staging, UAT &amp;amp; Production&lt;/li&gt;
&lt;li&gt;Setup the minimalistic React native application using RN CLI or Expo (I am not here to help you choose the one). But as a matter of fact, we chose RN CLI just because of the simplicity.&lt;/li&gt;
&lt;li&gt;Setup environment files (We used React native config package to use inside the application, it's pretty good).&lt;/li&gt;
&lt;li&gt;Add a basic Readme file with instructions for the team on how to run the app on local.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flhuria94.github.io%2Fassets%2Fimg%2F2020-10-25-how-to-plan-and-execute-your-first-mobile-app-using-react-native%2Freadme.png" alt="readme"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Next step was...Enforcing linting using Pre-commit hooks, editor configurations
&lt;/h2&gt;

&lt;p&gt;This was really important, because when reviewing code; you will see a lot of indent issues, basic standards not being followed in the team. So, it makes sense to set it up in the first place and enforce it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tasks to be done as part of enforcing standards
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Setup Linter and Prettier rules for the application&lt;/li&gt;
&lt;li&gt;Add a pre-commit hook with ESlint rules in place&lt;/li&gt;
&lt;li&gt;Define an editor config to be used by the team (Assuming we’re using VS code) 😉
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flhuria94.github.io%2Fassets%2Fimg%2F2020-10-25-how-to-plan-and-execute-your-first-mobile-app-using-react-native%2Fvsconfig.png" alt="vsconfig"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Decide on the directory structure
&lt;/h2&gt;

&lt;p&gt;When you have a team working remotely, it's hard to have them follow the rules w.r.t structuring your components, files, directories, etc since React does not enforce any. So, sitting with the team and hear our how would they like to structure the application and why. Consolidate things, and define rules on what to call what, what to put where, etc. This worked perfectly for us and it went super smooth.&lt;/p&gt;

&lt;p&gt;I have a short post specifically for this. Check it &lt;a href="https://lhuria94.github.io/structure-react-native-project%20copy/" rel="noopener noreferrer"&gt;out&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Analyse essential libraries/packages to be used
&lt;/h2&gt;

&lt;p&gt;When you are working on React/React-native or any other JS framework, one of the important decision is to decide on the libraries. From my experience, a single bad decision on choosing a library that is going to be widely used can end up as a complete app refactor. That’s something that happened to me, so I’d argue that you take your time, check the pros and cons of the library, compare it with others, and then decide.&lt;/p&gt;

&lt;h3&gt;
  
  
  What we look for in a library
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Regular updates&lt;/li&gt;
&lt;li&gt;Open issues&lt;/li&gt;
&lt;li&gt;Community adoption &amp;amp; support&lt;/li&gt;
&lt;li&gt;Size&lt;/li&gt;
&lt;li&gt;Documentation&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Examples of most common use-cases for analysis
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Forms Library or Custom forms&lt;/li&gt;
&lt;li&gt;Styled components or SCSS or a mix of both&lt;/li&gt;
&lt;li&gt;Choosing Storybook&lt;/li&gt;
&lt;li&gt;File upload/picker&lt;/li&gt;
&lt;li&gt;UI library or Custom components/theme&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup basic Typography
&lt;/h2&gt;

&lt;p&gt;Assuming that we have a style guide provided by the UI designer, the next step would be to analyze and come up with the list of re-usable typographies that will be used throughout the application.&lt;br&gt;
This is necessary since you don't want the team to create the styles again and again when they feel the need.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example of Typography components
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Heading&lt;/li&gt;
&lt;li&gt;SubHeading&lt;/li&gt;
&lt;li&gt;Section&lt;/li&gt;
&lt;li&gt;Body&lt;/li&gt;
&lt;li&gt;Paragraph&lt;/li&gt;
&lt;li&gt;Link&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup Theme
&lt;/h2&gt;

&lt;p&gt;When you are working on a mobile app, there is a good chance that you will need to take care of dark mode as well. &lt;br&gt;
For that, it's essential that we keep the strategy of plugging in modes as and when required.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tasks we did to make sure our app is ready for dark mode requirements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Setup a theme provider&lt;/li&gt;
&lt;li&gt;Create both light.js and dark.js theme&lt;/li&gt;
&lt;li&gt;Setup the branding colors, fonts, basic spacers, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  QA Phase
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Setup beta application
&lt;/h2&gt;

&lt;p&gt;In order to set up the distribution means or link the application to a business entity, we would need an application setup in the App Store. Using which we will be able to get our application tested via Testflight or exporting an IPA/APK file respectively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tasks to do here
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Setup test application for different environments&lt;/li&gt;
&lt;li&gt;Enable QA’s to download the app via Testflight&lt;/li&gt;
&lt;li&gt;Automate the build &amp;amp; distribution process via CI/CD service (e.g. App Center)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Choose a Profiling tool
&lt;/h2&gt;

&lt;p&gt;A profiling tool is necessary in order to look for potential bottlenecks during development. And this process should come as a part of your development cycle without worrying about the impacts/problems that might show up later.&lt;/p&gt;

&lt;h1&gt;
  
  
  Business Phase
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Involve stakeholders for app submission info
&lt;/h2&gt;

&lt;p&gt;Now, when you are in the phase of submitting your application, Apple will ask you a good amount of business information which you probably would not have the information handy. I’d suggest starting this conversation a bit early in the phase so there are no surprises or delays. That's something we did and which I feel was a smart decision.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example of what type of information would be required
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Name of the application&lt;/li&gt;
&lt;li&gt;Support URLs&lt;/li&gt;
&lt;li&gt;Category of the application&lt;/li&gt;
&lt;li&gt;Screenshots&lt;/li&gt;
&lt;li&gt;Keywords&lt;/li&gt;
&lt;li&gt;Description&lt;/li&gt;
&lt;li&gt;Age Rating and so on...&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's all I had!&lt;/p&gt;

&lt;p&gt;Thanks for reading. 😃&lt;br&gt;
Visit my blog for the original &lt;a href="https://lhuria94.github.io/how-to-plan-and-execute-your-first-mobile-app-using-react-native/" rel="noopener noreferrer"&gt;post&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>architecture</category>
      <category>mobileapps</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>What is IAM? (A beginner's guide)</title>
      <dc:creator>Love Huria</dc:creator>
      <pubDate>Mon, 25 May 2020 14:01:18 +0000</pubDate>
      <link>https://dev.to/lhuria94/what-is-iam-a-beginner-s-guide-25m2</link>
      <guid>https://dev.to/lhuria94/what-is-iam-a-beginner-s-guide-25m2</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Ah, it feels good to be back into blogging days 🤩. So, a little bit about what I’m up to these days; I am currently engaged in helping build an identity and access management solution for one of the projects. Now in IAM, there are a lot of things to cover but we will focus on the basics of it. While working on this piece, I have realized that the core concepts are often a gap in understanding with respect to what it actually means.  So, I am here to share the learnings in this post as per my experience. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What is IAM (Identity and access management)?
&lt;/h3&gt;

&lt;p&gt;If we wanted to understand in simple words, let's break it down:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The first word is Identity ~&lt;/strong&gt; This, we can relate to the punch card attendance system. It's usually a flat and stiff paper and contains digital information, people just need to wave near a reader, and then ensures whether the correct person is logging in/out. Similarly, here it also means &lt;code&gt;verifying the user who they claim to be&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Second is Access ~&lt;/strong&gt; This determines what level of access is provided to an individual. An easy way to understand is if you go to a nightclub/Casino, and there are guards taking care of who is allowed to come in, who can access the VIP area.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Third is Management ~&lt;/strong&gt; All of this falls under IT (Security) departments to manage the access control, policies, reporting, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  A little more about it:
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Identity and access management&lt;/em&gt; also called &lt;em&gt;Identity Management system (IDMS)&lt;/em&gt; in the enterprise is as crucial as anything these days and it's all about setting up standards and addressing the needs around enabling the right access at the right time for individuals to access not only IT resources but the hardware and applications employees require. It's often required to meet rigorous and complex security compliance requirements.&lt;/p&gt;

&lt;p&gt;IAM’s pretty popular especially with enterprises as there is a critical need to manage information that is spread across internal and external applications with data security in mind. &lt;/p&gt;

&lt;p&gt;IAM’s core objective is to assign &lt;code&gt;one identity per individual&lt;/code&gt; and have the ability to control it from one place which would help reflect in all systems. It also helps the ability to monitor user’s activities, permit user roles, enforce policies at org level which is an on-going process (basically handles authn (Authentication) and authz (Authorization)). &lt;/p&gt;

&lt;h3&gt;
  
  
  How IAM works?
&lt;/h3&gt;

&lt;p&gt;IAM is designed to perform three things - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identify&lt;/li&gt;
&lt;li&gt;Authn (Authentication)&lt;/li&gt;
&lt;li&gt;Authz (Authorization)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A lot of people gets confused b/w Authentication and Authorization, ill try to explain in a simplistic way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication:&lt;/strong&gt; When you enter a username/email &amp;amp; password into an application, the app tries to authenticate by checking the database and if the information which you entered matches; that means you are authenticated.&lt;/li&gt;
&lt;/ul&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2020-05-25-what-is-iam%2Fauthentication.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2020-05-25-what-is-iam%2Fauthentication.png" alt="authentication"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authorization:&lt;/strong&gt; This simply means the level of access. For example: If you log in to Facebook, you are allowed to see other’s profiles but not modify it.&lt;/li&gt;
&lt;/ul&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2020-05-25-what-is-iam%2Fauthorization.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2020-05-25-what-is-iam%2Fauthorization.png" alt="authorization"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That being said, here are the core components of any IAM system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Identity Management:&lt;/strong&gt; As the name suggests, it means managing every aspect of an individual’s identity. This includes managing Onboarding (provisioning), offboarding (de-provisioning), and on-going sync from the source to target systems/directories. And there are multiple identity protocols being used such as OAuth2.0, OIDC, SAML, LDAP, etc. For Identity management to happen, there are few building blocks required:

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Source:&lt;/strong&gt; The origin of the individual (from where the identities originate) i.e kind of a directory of the personal data used to define individual users. This is usually done by looking at the applications which contain staff data to be the source of truth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Central Repository:&lt;/strong&gt; For user’s information to be consistent b/w source and target system, syncing is essential. And for syncing to happen, it's important to have a central store that presents a logical view of the identities of an enterprise. It usually works by identifying a unique identifier basis to ensure that the provisioning, de-provisioning, updates are happening accurately.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target:&lt;/strong&gt; These systems can be defined as any application being used which requires authentication and authorization. For example, company portals, mobile apps, etc.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication:&lt;/strong&gt; Today, authentication does not only mean entering credentials and logging into a system but also making it secure by adding MFA, adaptive authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authorisation:&lt;/strong&gt; After authentication, the next step in any Identity and access management system comes is authorizing the users for assigned access to specific apps, resources based on the user’s provisioning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reporting:&lt;/strong&gt; This is all about recording, capturing user activities, auditing, monitoring, etc. This ultimately helps enterprises prove compliance with regulations, identify and address any potential security risks, and improve it further down the lane.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSO:&lt;/strong&gt; This is my favorite, one the best ones. Keeping security in mind, it enhances the user experience a lot since the number of credentials an employee requires to access is automatically reduced. And it's much easier to control the user’s access from one place. I read somewhere, SSOs become SPOFs if not implemented correctly, and here too a centralized IAM system allows to control access more efficiently.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why do we need IAM?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Security:&lt;/strong&gt; This is one of the core motives for any organization introducing IAM i.e controlling access which ultimately results in preventing identity theft, illegal access to sensitive information. It can also prevent unauthorized logins, protect against phishing attacks (and other cyber attacks). It also incorporates proper reporting, regardless of the application, platform, decide (Including BYOD options), helping with Location flexibility.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance:&lt;/strong&gt; IAM is not just about keeping things secure; intact following certain regulations according to the region is also crucial. So, compliance like HIPAA, PCI, GDPR, etc can be ensured since IAM specify strict protocols to control what and how of n/w and resources users can use. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost Reduction &amp;amp; Maintainability:&lt;/strong&gt; If there is any change to the organization-wide followed policy e.g. “Password Policy”, then with IAM, it can be done in one go. Hence reducing the workload of requests to the IT team to do it. Furthermore, it reduces Identity management costs like Onboarding, offboarding, implementing policies, processes, etc&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improves User Experience:&lt;/strong&gt; IAM helps with implementing the “Single sign-on” feature which is really trending especially in enterprises. With SSO, the user does not need to enter passwords to access multiple systems.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Must-haves before/during IAM implementation:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;I was reading one article about &lt;code&gt;the concept of putting all your eggs in one basket is a bit scary&lt;/code&gt;. A centralized system may seem tempting but its also usually an opportunity for hackers and by putting dashboards, monitoring user’s activity closely will help prevent it.&lt;/li&gt;
&lt;li&gt;Working with legacy systems since most of the enterprises try to work it out but sometimes that’s not how it works with newer tech. Keeping the legacy systems alive with redundant workloads/tasks should be avoided as much it’s possible.&lt;/li&gt;
&lt;li&gt;Collaboration is important across different departments is necessary. Working with our stakeholders step by step with everyone’s buy-in help in the long run for taking crucial decisions.&lt;/li&gt;
&lt;li&gt;Multiple sources of identity information creates issues as well sometime, but the IAM system should be able to take care of that beforehand; synchronizing the identity across different systems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's all. If you would like to read more about it, I'd refer a few good links to go through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.identityandaccess.org/the-basic-principles-of-identity-management-and-cloud-adoption/" rel="noopener noreferrer"&gt;The basic principles of Identity Management and Cloud adoption&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.varonis.com/blog/what-is-iam/" rel="noopener noreferrer"&gt;What is IAM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading. 😃&lt;br&gt;
Visit my blog for the original &lt;a href="https://lhuria94.github.io/what-is-iam/" rel="noopener noreferrer"&gt;post&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>identity</category>
      <category>security</category>
      <category>authentication</category>
      <category>access</category>
    </item>
    <item>
      <title>Structure a React Native App</title>
      <dc:creator>Love Huria</dc:creator>
      <pubDate>Sat, 11 Apr 2020 10:34:08 +0000</pubDate>
      <link>https://dev.to/lhuria94/structure-a-react-native-app-ig</link>
      <guid>https://dev.to/lhuria94/structure-a-react-native-app-ig</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Heads up! The structure proposed in this post is not official, it just worked nicely for me and hopefully, it will help someone else on this earth. 🙂&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here we are, writing my first post around React Native after successfully launching an app in the App Store. Not at all showing off. It was a Team effort.&lt;/p&gt;

&lt;p&gt;But it really gave me insight with respect to "How to work around mobile apps" after being in web stack for so long. Fantastic change and am really in love with "React Native". 🤩&lt;/p&gt;

&lt;p&gt;This post is specifically about how to structure your React Native apps/projects in terms of folders/files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Background of "Why this is even helpful"
&lt;/h3&gt;

&lt;p&gt;React is created by &lt;a href="https://opensource.facebook.com/" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt; and being used by a variety of organizations. So, Instead of being opinionated on the folder/file structure of the application, its left to the individuals to decide how they would like to build it. &lt;/p&gt;

&lt;p&gt;This further leads to different approaches proposed by either community or individuals solving different problems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure we follow
&lt;/h3&gt;

&lt;p&gt;Below Structure assumes the following (But not mandatory in all projects):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have Redux in your architecture&lt;/li&gt;
&lt;li&gt;You have support for dark mode as well&lt;/li&gt;
&lt;/ul&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2020-04-11-structure-react-native-project%2Fstructure.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2020-04-11-structure-react-native-project%2Fstructure.png" alt="Structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you look at the above structure, most of it is self-explanatory. However, I would like to focus on some of the aspects.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;src/api&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;helper.js - This file will have helper methods w.r.t any code related to APIs. Like get, post, put, etc.&lt;/li&gt;
&lt;li&gt;utils.js - Here we could add usual utility functions.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;assets&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;icons - Keep all of your icons (SVGs) or any other format you usually use.&lt;/li&gt;
&lt;li&gt;images - Keep all of your images (background images), logos, etc.&lt;/li&gt;
&lt;li&gt;themes&lt;/li&gt;
&lt;li&gt;light.js - Have all of your light theme styles here such as color palette, fonts, etc.&lt;/li&gt;
&lt;li&gt;dark.js - Have all of your dark theme styles here.&lt;/li&gt;
&lt;li&gt;themeProvider.js - This will contain the logic of deciding which theme to use based on the User's preferences.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;components&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;common - This will contain re-usable isolated components like button, input, tabs, etc.&lt;/li&gt;
&lt;li&gt;sections - This will contain reusable sections like navigation i.e sidebar, bottom navigation, etc.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;config&lt;/strong&gt; - I find this particularly very useful, we keep all the configurations with respect to say forms, static lists, action messages, validation messages, etc.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;features&lt;/strong&gt; - A lot of people call this directory as components as well, which seem confusing to me as we can have more components inside features as well. This will have standard modules/features, the basic functionality of the site.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;global&lt;/strong&gt; - This will have global functions that can be reused throughout the application.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;routes&lt;/strong&gt; - This will have site-level navigation defined.

&lt;ul&gt;
&lt;li&gt;routes.navigator.js&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;store&lt;/strong&gt; - This will contain the app level state management which will serve the app current state.&lt;/li&gt;

&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Keep in mind, that this structure is not specific to react-native, we could use in "React" projects as well. That's up to us.&lt;br&gt;
Furthermore, the structure does not include core files such as package.json, babel, eslint, etc as they are mostly going to be at the root anyway.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's all. If you would like to read more about it, I'd refer few good links to go through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://medium.com/react-native-training/best-practices-for-creating-react-native-apps-part-1-66311c746df3" rel="noopener noreferrer"&gt;Best Practices for React native apps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading. 😃&lt;br&gt;
Visit my blog for the original &lt;a href="https://lhuria94.github.io/structure-react-native-project/" rel="noopener noreferrer"&gt;post&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>mobileapps</category>
      <category>reactnative</category>
      <category>react</category>
    </item>
    <item>
      <title>Understanding Time complexity - Big O Notation</title>
      <dc:creator>Love Huria</dc:creator>
      <pubDate>Sat, 26 Oct 2019 09:39:25 +0000</pubDate>
      <link>https://dev.to/lhuria94/understanding-time-complexity-big-o-notations-5a2a</link>
      <guid>https://dev.to/lhuria94/understanding-time-complexity-big-o-notations-5a2a</guid>
      <description>&lt;p&gt;Lately, I have gotten an interest in algorithms, the first one I chose to understand deeply is how sorting algorithms work and their time complexity. However, this post is not to explain sorting algorithms, instead, we will take a step back and understand time complexity [Big O Notation] in the simplest way possible.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before we go any further, let's understand what is an Algorithm:
&lt;/h3&gt;

&lt;p&gt;An Algorithm is a step by step instruction, telling a program to execute in a certain way to solve a particular problem. And it's pretty obvious, that when we run a program in any language, it will have its own execution time depending on various factors such as input, operations being performed, etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  Now the next question would "What is Time complexity"?
&lt;/h4&gt;

&lt;p&gt;Time complexity is the execution time it takes for your algorithm to solve a problem. Simple, right?. &lt;/p&gt;

&lt;p&gt;To explain it a little further, the time complexity is driven by two things i.e. execution time &amp;amp; the space required by the program.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why do we need to measure the time complexity?
&lt;/h4&gt;

&lt;p&gt;As programmers, when we write a program, it's kind of important to understand the different operations we are performing which can be checked by measuring the complexity. Normally, the execution time is taken for granted, we don’t care about mi-nute calculations which are happening behind the scene. So, overall, time complexity helps us to improve the efficiency of the code we’ve written.&lt;/p&gt;

&lt;h4&gt;
  
  
  How do we measure time complexity?
&lt;/h4&gt;

&lt;p&gt;The answer is &lt;strong&gt;Big O Notation&lt;/strong&gt; when the letter O means &lt;code&gt;Order of the program&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Big O Notation (a mathematical expression) helps to measure the time complexity by classifying how your program behaves with varying input and taking in different operations.&lt;/p&gt;

&lt;p&gt;Let’s understand the common types of notations, we will use Javascript here to explain with examples, although the idea is similar for different languages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Big O Notations:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Constant-Time Algorithm - O (1) - Order 1&lt;/strong&gt;:
This is the fastest time complexity since the time it takes to execute a program is always the same. It does not matter that what’s the size of the input, the execution and the space required to run this will be the same. 
&lt;em&gt;For example&lt;/em&gt;: Take a case of simple array lookup or getting the last item of the array.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flhuria94.github.io%2Fassets%2Fimg%2F2019-10-26-time-complexity-notations%2Fconstant.png" alt="Constant Time Algorithm"&gt;
The above example will always go through the array once and finds the salary of an employee called &lt;code&gt;Joe&lt;/code&gt;. That means, constant (fixed) iteration is involved i.e &lt;code&gt;O(1)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linear-Time Algorithm - O(n) - Order N&lt;/strong&gt;:
Linear Time complexity completely depends on the input size i.e directly proportional. One of the examples could be just printing the elements from an array OR finding a particular match in an array.
While calculating, we should always think of both the “best” &amp;amp; “worst” scenario.
&lt;em&gt;For example&lt;/em&gt;: If we were to match a specific element in an array, then it can be the very first one or the last one, so in that case, we can assume its O(n).
&lt;em&gt;Let’s take an example here&lt;/em&gt;:
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flhuria94.github.io%2Fassets%2Fimg%2F2019-10-26-time-complexity-notations%2Flinear-time.png" alt="Linear Time Algorithm"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quadratic-Time complexity - O(n2) - Order N Squared&lt;/strong&gt;:
As the name suggests, the time to execute a program is proportional to the square of the input size. That means, in our program, when we are trying to perform two operations which are kind of a combination of Linear and Constant time complexity, then those are called Quadratic-time complexity.
This type of complexity is commonly used with sorting algorithms. 
&lt;em&gt;Let’s try to understand by taking an example&lt;/em&gt;: 
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flhuria94.github.io%2Fassets%2Fimg%2F2019-10-26-time-complexity-notations%2Fquad-time.png" alt="Quadratic Time Algorithm"&gt;
In this example, it is clear that we first have a single filter loop at the top iterating over an array once, then we have a nested loop that is looking for similar salaries of the employees by iterating through the array again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logarithmic-Time Algorithm - O(log n) - Order log N&lt;/strong&gt;:
This is considered the most efficient way to deal with a large number of data in a set. The idea behind this approach is to divide the data into chunks and then perform operations.
A &lt;code&gt;logarithm&lt;/code&gt; is basically a quantity that represents the base power, that means if the data grows logarithmically then it's literally being divided.
For example, if we want to find a salary of a few employees from 50 records, then that means we usually have to go through each record and look for it. Assuming if we use &lt;code&gt;log base 2&lt;/code&gt;, we would be able to find it in &lt;code&gt;log2(50) = ~6&lt;/code&gt; iterations. That is a lot of power!
Its commonly used with different sorting algorithms such as QuickSort, Merge-sort which is usually used to find an element or sort a list. Or binary Search is a good example.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flhuria94.github.io%2Fassets%2Fimg%2F2019-10-26-time-complexity-notations%2Flog.png" alt="Logarithmic Time Algorithm"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think we've covered most commonly used notations. If you would like to read more about it, I'd refer a few good links to go through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.bigocheatsheet.com/" rel="noopener noreferrer"&gt;Big O CheatSheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/" rel="noopener noreferrer"&gt;Beginner's Guide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading. 😃&lt;br&gt;
Visit my blog for the original &lt;a href="https://lhuria94.github.io/time-complexity-notations/" rel="noopener noreferrer"&gt;post&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>performance</category>
    </item>
    <item>
      <title>Creating your own React Boilerplate - For Beginners</title>
      <dc:creator>Love Huria</dc:creator>
      <pubDate>Sun, 20 Oct 2019 08:47:35 +0000</pubDate>
      <link>https://dev.to/lhuria94/creating-your-own-react-boilerplate-for-beginners-4ni7</link>
      <guid>https://dev.to/lhuria94/creating-your-own-react-boilerplate-for-beginners-4ni7</guid>
      <description>&lt;p&gt;Well, It's been a while working on React, still learning and it feels pretty awesome. We all understand how important it is to interpret the basic concepts before we set our path to work with any framework or library.&lt;/p&gt;

&lt;p&gt;Usually what happens, even as a beginner we tend to jump on things without understanding how it works, to see the practical usage, fancy stuff etc and hey &lt;code&gt;You are not alone!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But sometimes, it's good to come back on time and try to understand the underlying pieces. There are tons of boilerplates available which are really helpful to kickstart the project as a solid foundation and the plus point is most of these boilerplates are built by Industry experts.&lt;/p&gt;

&lt;p&gt;Taking my past experiences into account, there have been multiple React projects I have worked upon; so sooner or later we get to overcome the fear of setting up our own &lt;code&gt;package.json&lt;/code&gt; and &lt;code&gt;webpack&lt;/code&gt; configurations. &lt;/p&gt;

&lt;p&gt;So, here we will try to set up our own boilerplate or you can say our own way of &lt;em&gt;React&lt;/em&gt; project set up with some interesting packages which normally get used at some point.&lt;/p&gt;

&lt;p&gt;Now in order to build our boilerplate, the very first thing we need to understand is &lt;code&gt;package.json&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is package.json and why do we need it
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;package.json&lt;/code&gt; file is an essential part of the Javascript (Node) eco-system. It’s like one of the very first baby step developers takes while starting development in Node.js. Also, It helps in streamlining the process, managing packages for your project. You can say, its essentially a manifest file that contains the metadata like name, description, package versioning etc of the project (All in one place). &lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up package.json
&lt;/h3&gt;

&lt;p&gt;Defining the metadata by typing it out i.e creating a &lt;code&gt;package.json&lt;/code&gt; is always an option, but we don't have to do it in case you are setting up a new project. Instead, there are existing ways to commandify it. We can use standard package managers such as &lt;em&gt;NPM, YARN&lt;/em&gt; as they help interactively in creating/updating a &lt;code&gt;package.json&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;You must have heard about &lt;em&gt;NPM, YARN&lt;/em&gt;, but in this post, we will be using &lt;em&gt;Yarn&lt;/em&gt; to setup our react boilerplate. In case, you would like to read about the differences, check this out &lt;a href="https://waverleysoftware.com/blog/yarn-vs-npm/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Continuing, Let’s try to explain Yarn in the simplest way possible
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Yarn&lt;/em&gt; is a package manager that lets you use code developed by the community from around the world which eventually makes things easier to build the solution. &lt;/p&gt;

&lt;p&gt;This collection of functionality is something called package.&lt;/p&gt;

&lt;p&gt;To set up &lt;code&gt;package.json&lt;/code&gt;, &lt;em&gt;Yarn&lt;/em&gt; provides an initialize command, which will give you a kind of a questionnaire about the project and that tends to be your project’s metadata.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Run `yarn init` in terminal.&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt;

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



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9yoM4f0e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-init.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9yoM4f0e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-init.png" alt="yarn_init"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After filling in all the required information, it will create a &lt;code&gt;package.json&lt;/code&gt; file at the root of the project’s directory. It should look like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IE7CZ7DP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-init-package-json.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IE7CZ7DP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-init-package-json.png" alt="yarn_init_package_json"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What does this mean to us?
&lt;/h3&gt;

&lt;p&gt;Let’s talk about it one by one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;name&lt;/strong&gt;: This contains our package’s name and it does not allow spaces and instead it should be lowercase separated by hyphens/underscores. For example: &lt;em&gt;react-boilerplate&lt;/em&gt;. 😊&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;version&lt;/strong&gt;: This is the standard metadata for any kind of module, it should be in the format 'x.x.x' (Usually starts with 1.0.0). It follows semantic versioning (semver). Read more about it &lt;a href="https://semver.org/"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;description&lt;/strong&gt;: This is just a human-friendly description of your project/module. It helps developers to understand quickly regarding the intentions of the project or module. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;main&lt;/strong&gt;: This can be taken as the bootstrap file i.e an entry or lookup file when application boots up. Usually &lt;code&gt;index.js&lt;/code&gt;, but it's upto us to change it or not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;author&lt;/strong&gt;: This is generally a piece of information about who’s writing the project/module, could be name, email address, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;license&lt;/strong&gt;: This explains about the license the project/module belongs to. It could be MIT, ISC, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  While can be few other questions which you probably won't see in the package.json file, but can add such as:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;repository URL&lt;/strong&gt;: Here we can mention the URL where the code is being hosted, so developers can check more details.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;private&lt;/strong&gt;: If set to true, then you won’t be able to publicly release your project/module to the community. Prevents accidental publication.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that we understand the basic metadata of the &lt;code&gt;package.json&lt;/code&gt; file, let’s go ahead and set up our boilerplate (for which the post was intended for 😉).&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup minimal React boilerplate
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Quicktip: To add packages using &lt;em&gt;YARN&lt;/em&gt;, we can use &lt;code&gt;yarn add &amp;lt;package_name&amp;gt;&lt;/code&gt;, &lt;code&gt;yarn add --dev &amp;lt;package_name&amp;gt;&lt;/code&gt; (To add as dev dependency) similarly to remove; use &lt;code&gt;yarn remove &amp;lt;package_name&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Installing React and ReactDOM&lt;/strong&gt;: React (Javascript Library) package contains just the code required to define react components, state, props (All that is &lt;em&gt;React&lt;/em&gt;) where React DOM works as a React renderer for the web, it works as a glue between React and the DOM.  
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3PBFMsI6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/react-rdom-install.png" alt="react_install"&gt;  
If you see your &lt;code&gt;package.json&lt;/code&gt; file, there should be &lt;em&gt;React&lt;/em&gt; and &lt;em&gt;ReactDOM&lt;/em&gt; listing under the &lt;code&gt;dependencies&lt;/code&gt; of your project. It indicates, that now your project depends on &lt;em&gt;React&lt;/em&gt; and &lt;em&gt;ReactDOM&lt;/em&gt;. 
You might have noticed that there is a new directory created &lt;em&gt;node_modules&lt;/em&gt; at the root of your project. This is where your installed packages will be kept. If you check there should be a &lt;em&gt;React&lt;/em&gt; directory under &lt;em&gt;node_modules&lt;/em&gt; which helps run React for the application. 
To use the React functionality, you might want to import it in your &lt;code&gt;.js(x)&lt;/code&gt; file like:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7tf389m7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/import-react.png" alt="import_react"&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Webpack&lt;/strong&gt;: In simple terms, its a bundler which helps bundles your files, images, assets, scripts, styles, module dependencies. It takes in modules with dependencies and spits bundled code which browsers can understand. &lt;br&gt;&lt;br&gt;
We can install web pack using &lt;em&gt;Yarn&lt;/em&gt; as a dev dependency:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l6V8j0bP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-add-webpack.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l6V8j0bP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-add-webpack.png" alt="yarn_add_webpack"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Babel&lt;/strong&gt;: While working on React, we usually follow &lt;a href="https://es6.io/"&gt;ES6&lt;/a&gt;. Since older browsers can not understand the syntax say &lt;em&gt;Class&lt;/em&gt; keyword, &lt;em&gt;import&lt;/em&gt; statements. For these to be converted to ES5 which browsers can understand, we need Transpiler. That’s how &lt;code&gt;Babel&lt;/code&gt; comes in picture.  &lt;br&gt;&lt;br&gt;
&lt;strong&gt;You are probably thinking, then what is the use of Webpack?&lt;/strong&gt;  &lt;br&gt;&lt;br&gt;
Webpack does not have the capability to transpile the code from ES6 to ES5, but it has this concept of loaders which helps in transforming the code and outputs the browser-compatible code.&lt;br&gt;&lt;br&gt;
Loader, which we will use is &lt;code&gt;babel-loader&lt;/code&gt; which internally used &lt;code&gt;Babel&lt;/code&gt; and requires a certain level of configurations/presets i.e &lt;code&gt;babel preset env&lt;/code&gt; (Used for transpiling code from &amp;gt;=ES6 to ES5) &amp;amp; &lt;code&gt;babel preset react&lt;/code&gt; (Used for transpiling &lt;code&gt;.Jsx&lt;/code&gt; code to ES5). &lt;br&gt;&lt;br&gt;
Let's install and configure babel and the required dependencies:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jTdfRopJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-add-babel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jTdfRopJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-add-babel.png" alt="yarn_add_babel"&gt;&lt;/a&gt;&lt;br&gt;
To complete the setup, we would need to create a file called &lt;code&gt;.babelrc&lt;/code&gt; and define the configuration as below:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AfUOA5ok--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/babelrc-file.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AfUOA5ok--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/babelrc-file.png" alt="babel_rc_file"&gt;&lt;/a&gt;&lt;br&gt;
To set up the &lt;code&gt;babel-loader&lt;/code&gt; and make it work as a web pack loader, we would need to define the configuration like below in a file called &lt;code&gt;webpack.config.js&lt;/code&gt; at the root of the project:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T3WywUJU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/webpack-config.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T3WywUJU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/webpack-config.png" alt="webpack_config_file"&gt;&lt;/a&gt;&lt;br&gt;
If we want to decode the configuration, then it's just telling Webpack to take in js, jsx code and use babel for transpiling and output the ES5 browser compatible code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTML Webpack Plugin&lt;/strong&gt;: This plugin helps to generate HTML files which ultimately serves Webpack generated bundles. That means, when webpack creates a new javascript bundled file, then it also needs an html file to serve on the client-side with the latest changes. &lt;br&gt;&lt;br&gt;
Let's install the plugin and the loader as a dev dependency:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KlJ27X7A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-add-html-plugin.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KlJ27X7A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-add-html-plugin.png" alt="yarn_add_html_plugin"&gt;&lt;/a&gt;&lt;br&gt;
Wait, we are not done with the HTML plugin yet, we would need to configure it with Webpack as well. Earlier we defined, &lt;code&gt;babel-loader&lt;/code&gt; to transpile the code, now we would need to define &lt;code&gt;html-loader&lt;/code&gt; for generating the HTML.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Load the plugin in your webpack.config.js file.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;HtmlWebPackPlugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;html-webpack-plugin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;module&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\.(&lt;/span&gt;&lt;span class="sr"&gt;js|jsx&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;$/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;exclude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/node_modules/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;use&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;babel-loader&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="c1"&gt;// Add HTML loader to serve HTML files.&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="sr"&gt;html$/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;use&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;html-loader&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="c1"&gt;// Call the Plugin here.&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;HtmlWebPackPlugin&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./public/index.html&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./index.html&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The setup is almost complete, but there is a downside to this. Whenever we will make any change to the code, we would need to manually refresh the page to see our changes. In order to overcome this problem, we can install another package called &lt;code&gt;webpack-dev-server&lt;/code&gt; as a dev dependency.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Lf-Hde8f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-add-webpack-server.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Lf-Hde8f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-add-webpack-server.png" alt="yarn_add_webpack_dev_server"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To make this work either webpack command directly or its best that we modify our &lt;code&gt;package.json&lt;/code&gt; and add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Open flag is for opening the browser as soon as we run `yarn start`.&lt;/span&gt;
&lt;span class="c1"&gt;// Hot flag is for hot reloading i.e refresh the page as soon as you make any change to the code.&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;start&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;webpack-dev-server --config webpack.config.js --open --hot&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;build&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;webpack --config webpack.config.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Running the React Application
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Start by creating a folder called &lt;code&gt;src/&lt;/code&gt; which will contain a couple of files such as &lt;code&gt;index.js&lt;/code&gt; (Rendering the app) and &lt;code&gt;App.js&lt;/code&gt; (Contents of the App).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is just a dumb component which is exposing some static text:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2DZB4E8F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/app.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2DZB4E8F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/app.png" alt="app_js"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is importing the dumb component we just created and rendering on the page, basically injecting on the element ID &lt;code&gt;react-app-container&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KjAEB73t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/index.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KjAEB73t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/index.png" alt="index_js"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you can start your application using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Should get something like this in your terminal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rpwcl2ks--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-start-success.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rpwcl2ks--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://lhuria94.github.io/assets/img/2019-10-20-creating-own-react-boilerplate/yarn-start-success.png" alt="Yarn start App"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And we're all set here.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can check out the boilerplate for the complete folder structure &lt;a href="https://github.com/lhuria94/minimal-react-boilerplate"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thanks for reading. 😃&lt;br&gt;
Visit my blog for the original &lt;a href="https://lhuria94.github.io/creating-own-react-boilerplate/"&gt;post&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Time to level up Code Reviews</title>
      <dc:creator>Love Huria</dc:creator>
      <pubDate>Sun, 29 Apr 2018 18:50:51 +0000</pubDate>
      <link>https://dev.to/lhuria94/time-to-level-up-code-reviews-g2</link>
      <guid>https://dev.to/lhuria94/time-to-level-up-code-reviews-g2</guid>
      <description>&lt;p&gt;This is a follow up of my previous blog post on &lt;a href="https://dev.to/lhuria94/keeping-it-clean-coding-standards-that-matter--4e5p"&gt;code standards&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, Being part of a Code review process is very important for me and trust me I take it very seriously. This is required not just for the team but for an individual learning as well.&lt;/p&gt;

&lt;p&gt;Code reviews are very crucial for knowledge transfer and to avoid making small/common mistakes and of course maintaining best practices throughout the dev team. So Let’s take my team for example: we are around 12-15 developers in the team, all producing code which needs to be reviewed. So basically yeah that’s a whole lot of code!&lt;/p&gt;

&lt;h2&gt;
  
  
  Why It’s Important
&lt;/h2&gt;

&lt;p&gt;Pushing code to production is easy. Anyone can do it, right? What concerns us that what pieces we are going to deploy.&lt;/p&gt;

&lt;p&gt;The code can be completely fine or it can be a piece which can make everything fall apart. To maintain high code quality, we all need to have Peer code reviews. There is nothing negative here, we all are on the same team and we have a common goal that is to deliver the highest quality product.&lt;/p&gt;

&lt;p&gt;You must be thinking, Is it worth it? No? Yes?&lt;/p&gt;

&lt;p&gt;Definitely yes, Not having code review integrated into projects can result in big problems. You may have heard of the disaster happened long back: Here you &lt;a href="http://www.safetyresearch.net/blog/articles/toyota-unintended-acceleration-and-big-bowl-%E2%80%9Cspaghetti%E2%80%9D-code" rel="noopener noreferrer"&gt;go&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There was a lot of reason why this incident happened and one of the reasons was an absence of a peer code review. After reviewing their source code they found – possible bit flips, task deaths that would disable the fail-safes, memory corruption, single-point failures, inadequate protections against stack overflow and buffer overflow, single-fault containment regions, thousands of global variables. The list of deficiencies in process and product was lengthy.&lt;/p&gt;

&lt;h2&gt;
  
  
  How we roll things
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;General Development Process&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-10-16-time-to-level-up-code-reviews%2Fdev-process.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-10-16-time-to-level-up-code-reviews%2Fdev-process.png" alt="Dev process"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;FYI ;)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Green line: Determines pass status.&lt;/li&gt;
&lt;li&gt;Red line: Determines fail status.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is our general flow which is being followed in most of the projects, of course, columns may vary depending on the different aspects, clients, and projects. Hope it’s very clear 😓, if not I tried my best!! Haha 😄&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Github Code review flow&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-10-16-time-to-level-up-code-reviews%2Fgithub-project.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-10-16-time-to-level-up-code-reviews%2Fgithub-project.png" alt="Github project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now it’s really easy maintaining your code review process just a few clicks away on GitHub (And it’s really awesome!). We can create new projects on our repo and use it as we want.&lt;/p&gt;

&lt;p&gt;Generally, we have around four columns which are usually enough:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ready for review: You can add cards (Pull requests) to this column if your code is ready to be reviewed.&lt;/li&gt;
&lt;li&gt;In review: Now its code reviewer’s responsibility to move the card to "In review" column so that it gets updated on the branch and the concerned dev understands that his/her ticket is currently being reviewed.&lt;/li&gt;
&lt;li&gt;Change Requested: Again this is code reviewer’s responsibility to move the card to this column if the review has failed standards. Then concerned dev will do the required fixed and need to push the ticket back to “Ready for review”.&lt;/li&gt;
&lt;li&gt;Closed/Done: If the card is lying there in “Closed” column, that means the PR has passed standards it should have.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What to look for when reviewing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are certain aspects which we consider while reviewing code and some of them are the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Best practices pertaining to Drupal standards. Can be found &lt;a href="https://www.drupal.org/docs/develop/standards" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;JS specific coding standards. Can be found &lt;a href="https://www.drupal.org/docs/develop/standards/javascript/javascript-coding-standards" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;SCSS specific coding standards. Can be found &lt;a href="https://www.drupal.org/docs/develop/standards/css/css-coding-standards" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Anything developed which is adding technical debt. For instance choosing an easy solution making it harder to implement changes later on.&lt;/li&gt;
&lt;li&gt;Security issues&lt;/li&gt;
&lt;li&gt;Potential Impacts which can introduce performance issues/threats to existing solutions&lt;/li&gt;
&lt;li&gt;Solutions being developed which are already available in the codebase and can be reused.&lt;/li&gt;
&lt;li&gt;General standards like formatting, linting issues, comments, naming patterns etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Who is responsible&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We have set few guidelines on who will be responsible for the code review process. Here are the points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There will be one Senior and one Junior Code Reviewer for each ticket.&lt;/li&gt;
&lt;li&gt;Reviews will be done right after the daily standup. (Depending on how long it will take.)&lt;/li&gt;
&lt;li&gt;One person will review at least one ticket in a day (If there is any ticket assigned on the board)&lt;/li&gt;
&lt;li&gt;Tickets should be in respective columns according to the latest update. (Code reviewer &amp;amp; dev's responsibility)&lt;/li&gt;
&lt;li&gt;If there is any feedback from Senior code reviewer, its Junior code reviewer's responsibility to look what he/she has missed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Making sure the process being followed&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We regularly come back and observe how we are doing according to set process and if there is any way how we can improve to make sure it's being followed and not a burden/blocker for any one’s work.&lt;/p&gt;

&lt;p&gt;The process is clearly defined and maintained on different platforms depending on client and teams. We usually use Confluence and highly recommend it to anyone who is reading this post.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning from our mistakes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We have maintained a code feedback sheet where we mention common mistakes we need to avoid. Everyone has access from the team and can add points on where we can improve, new techniques to achieve certain functionality, strictly avoiding certain coding patterns.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Our goal is to&lt;br&gt;
Enhance the learning of individuals to become better programmers.&lt;br&gt;
Improving the quality of codebase, it gets complex to manage as it grows.&lt;br&gt;
Not to deliver just quantity but quality throughout.&lt;br&gt;
Maintaining discipline within the team and understand the seriousness of spaghetti code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s about it! Few things I may have missed for sure in this. Connect with me at &lt;a href="//mailto:lovehuria@gmail.com"&gt;lovehuria@gmail.com&lt;/a&gt; if you would like to know more OR just comment down here and save me all the trouble on checking my emails. :D&lt;/p&gt;

&lt;p&gt;Visit the original post &lt;a href="https://lhuria94.github.io/time-to-level-up-code-reviews/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Thanks for reading :)&lt;/p&gt;

</description>
      <category>feedback</category>
      <category>php</category>
      <category>productivity</category>
      <category>codereviews</category>
    </item>
    <item>
      <title>Keeping It Clean: Coding Standards That Matter </title>
      <dc:creator>Love Huria</dc:creator>
      <pubDate>Sun, 22 Apr 2018 12:35:05 +0000</pubDate>
      <link>https://dev.to/lhuria94/keeping-it-clean-coding-standards-that-matter--4e5p</link>
      <guid>https://dev.to/lhuria94/keeping-it-clean-coding-standards-that-matter--4e5p</guid>
      <description>&lt;p&gt;A year back, I was working on a project that taught me how to keep my code clean, modular, reusable, and all those terms that seem fancy, but are actually good for you in the long run. Interesting? Yeah a bit.&lt;/p&gt;

&lt;p&gt;But what did I do after getting into those practices?&lt;/p&gt;

&lt;p&gt;I made mistakes. Believe me, a lot of them. But with every mistake, I learnt a lot of stuff that I had never considered before. It helped me in my thinking process, on how we should build things, what steps we need to consider when we are developing/extending a feature. And most importantly, these learnings were not just personally helpful, but also crucial for team growth.&lt;/p&gt;

&lt;p&gt;At first we used to get frustrated because we had to follow the additional process like adding documentation, maintaining changelog files, following the code standards, and keeping them consistent throughout the team. These extra steps seemed cumbersome and we were not able to relate how this can be useful for us (team). And we are still learning/improving everyday in this respect. But after few months we started loving and improvising the process.&lt;/p&gt;

&lt;p&gt;So here I am, sharing my what I have learnt. And trust me when I say, after getting this into practice you can’t live without following this.&lt;/p&gt;

&lt;p&gt;This post is focused on what practices we follow everyday to make our lives easier (More focused on PHP/Drupal but can be followed, we follow pretty generic practices).&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s start off with simple things:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Commenting and Documentation Standards&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Commenting doesn’t mean adding a bunch of comments and random documentation anywhere while coding. There are things which you should mention to make your colleagues’ lives easier, and yours as well.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with writing a description of your component, why you are creating it, and what is the aim you would like to accomplish here, what does it do etc.&lt;/li&gt;
&lt;li&gt;If there are modifications being done, then those should be logged by creating a Changelog.md file attached to your component. Maintain a specific format to have consistency throughout.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is something we follow, hope this is pretty clear:&lt;br&gt;
CHANGELOG.md file sample:&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Fchangelog.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Fchangelog.png" alt="Changelog sample"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It’s good practice to add &lt;a class="mentioned-user" href="https://dev.to/see"&gt;@see&lt;/a&gt;, referencing the class, which will help easily navigate to that class definition by using IDE like PHPStorm, or editors like Sublime etc with just one click.&lt;/li&gt;
&lt;/ul&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Ffn-referencing.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Ffn-referencing.png" alt="Function referencing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add @TODOS wherever necessary. It’s very important if you feel your code can be improved in future and you have the ideas on how to do it, but not enough time at the moment. Mention what needs to be improved above that code snippet. One good example could be:&lt;/li&gt;
&lt;/ul&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Ftodo-example.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Ftodo-example.png" alt="Todo example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create README.md files so that others can easily understand what is the working of the module.
For example:&lt;/li&gt;
&lt;/ul&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Freadme-example.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Freadme-example.png" alt="Readme example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A “Docblock” is a special code comment that offers an explanation of the purpose, arguments, return values, and throw exceptions for a block of code.&lt;/li&gt;
&lt;/ul&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Fdocblock-example.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Fdocblock-example.png" alt="Docblock example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Something very informative in a simple tweet I found:&lt;/p&gt;

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

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



&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formatting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This might include indenting, whitespace, brace positions, and new lines and this can be different according to different languages. In our case, this is specific to PHP (Drupal). There are a lot of plugins available in editors to beautify your code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Naming Conventions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Of course naming conventions depend on the language you are using ( examples: Zend, Google style guides for PHP, CSS, Javascript, Java, etc ) but the main idea is to use descriptive and meaningful words. So, you should avoid calling your variables: xx, yy2, test1, test2 and so on.&lt;/li&gt;
&lt;li&gt;For example, lower_case for PHP variables and functions, camelCase for JS variables and functions, lower-case-hyphenated for CSS ID's and classes, UPPER_CASE for constants.&lt;/li&gt;
&lt;li&gt;We should name our variables in a way which easily explains the type of data they contain. Similarly in case of functions, they should describe what kind of functionality they are providing. This is called self-documenting code. Functions should tell what they do, not how. This is called abstraction which allows the underlying implementation to be changed without changing the function name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Portability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Keep your code as loosely coupled as possible. It is "portable" in that the amount of work required to move it from one platform to another is low. There are few things we should have in mind while coding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid using hardcoded values like absolute file paths, URLs etc  unless it’s a matter of life and death (:P)&lt;/li&gt;
&lt;li&gt;Avoid using magic numbers in your code. Basically it’s a hard-coded value that may change at a later stage, and hence become hard to update. Almost all numbers other than 0, 1 or 2 should be assigned to a constant at the top of the file. This provides a single point of change if the value changes, rather than a search-and-replace that could affect many files and potentially introduce bugs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Linters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are different types of tools available to find syntactic discrepancies in general, especially in interpreted languages like JavaScript, PHP, Python etc. They can also be used as simple debuggers for finding common errors. Here’s a look at the common linters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;PHP:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We use PHP Code Sniffer with Drupal integration. One can easily configure it with your editors such as Sublime which will show common PHP errors on save, which saves a lot of time and prevents errors before committing your changes.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Javascript:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We have Drupal JavaScript coding standards (note - these vary in several ways from Mavericks standards) in place but we use &lt;a href="http://jshint.com/docs/" rel="noopener noreferrer"&gt;JSHint&lt;/a&gt; for listing our JS related code checks.&lt;/li&gt;
&lt;li&gt;Wherever Drupal's JS formatting conventions conflict with JSHint, JSHint supersedes.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;SCSS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We do not have any SCSS related documentation on &lt;a href="https://www.drupal.org/node/1886770" rel="noopener noreferrer"&gt;Drupal.org&lt;/a&gt; but we do have Drupal CSS coding standards (these can be applied to SCSS code).&lt;/li&gt;
&lt;li&gt;You can find some documentation related to SCSSLint &lt;a href="https://github.com/brigade/scss-lint/blob/master/lib/scss_lint/linter/README.md" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Also it’s good to checkout Compass best practices as well.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Reusability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is something we are working on quite extensively. We are building reusable components which can be used in across different websites (which have almost the same purpose). These components will provide the basic functionality and styles which can be overridden in different websites according to their own requirements. The most important thing here is to identify what functionality can be turned into a component.The degree to which your code is reusable is largely based on how tightly it’s coupled with the rest of your code base. A good example can be building a banner slider which can be used in most of the websites.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modular&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This basically means keeping your code independent of others, so that one bad change to your code does not break everything else. This is similar to the concept of coupling in object oriented programming. It’s like breaking the website into its basic independent parts of a more manageable size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Continuous Integration Tools&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We use Travis CI. It’s a distributed continuous integration service used to build and test projects on github. The service is free for open source projects. You  might be wondering why you didn’t you use it before! 😛 Don’t worry, It’s never too late and &lt;a href="https://docs.travis-ci.com/user/getting-started/" rel="noopener noreferrer"&gt;pretty easy to setup with your github repositories&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First step is to register Travis-CI, which you can also do with your github account.&lt;/li&gt;
&lt;li&gt;Setup the .travis.yml file, This file handles the build of your environment and also the execution of the phpunit files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can check the simplest basic configuration here:&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Ftravis-repo.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Ftravis-repo.png" alt="travis repo example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you have the phpunit test in place and if it is passed, it will show something like this on your commit:&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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Ftravis-success-msg.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%2Flhuria94.github.io%2Fassets%2Fimg%2F2017-07-26-coding-standards-that-matter%2Ftravis-success-msg.png" alt="travis success message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can check the simple Travis setup &lt;a href="https://github.com/lhuria94/drupal/pull/3" rel="noopener noreferrer"&gt;here&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;This &lt;code&gt;.travis.yml&lt;/code&gt; should be at the root of the project.&lt;br&gt;
Travis only runs builds on the commits you push after you’ve enabled the repository in Travis CI.&lt;/p&gt;

&lt;p&gt;Code Reviews&lt;br&gt;
We have pretty awesome code review process in place. But this blog is already too long, so I shall cover that in my next blog. Stay tuned.&lt;/p&gt;

&lt;p&gt;Visit the original post &lt;a href="https://lhuria94.github.io/coding-standards-that-matter/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Thanks for reading :)&lt;/p&gt;

</description>
      <category>codequality</category>
      <category>codingstandards</category>
      <category>php</category>
      <category>drupal</category>
    </item>
    <item>
      <title>Cool things you can do with Sass - Part 1</title>
      <dc:creator>Love Huria</dc:creator>
      <pubDate>Fri, 20 Apr 2018 13:13:08 +0000</pubDate>
      <link>https://dev.to/lhuria94/cool-things-you-can-do-with-sass---part-1-1m9a</link>
      <guid>https://dev.to/lhuria94/cool-things-you-can-do-with-sass---part-1-1m9a</guid>
      <description>&lt;p&gt;I have been using Sass for like past two years and now I’m a huge fan. Even though we were doing pretty much alright with writing CSS but it never gave us that kind of flexibility that Sass provides like one of the things could be managing the complexity in stylesheets as our apps get more and more substantial. Anyways, Enough about my experience already as today we have got a bunch of cool things to cover!&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Sass?
&lt;/h2&gt;

&lt;p&gt;It's a CSS preprocessor, that’s what you will get if you start googling and its true but hold that thought as there’s more to it.&lt;/p&gt;

&lt;p&gt;Sass lets you use features like variables, nesting, inheritance and all with a CSS-compatible syntax. This is really obliging when you want to reduce repetition and make your massive stylesheets more organised.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; It's not a replacement for CSS, its kind of an interpreter/transpiler which spits out CSS in the end actually.&lt;/p&gt;

&lt;p&gt;You must be thinking, then what is the difference between Sass and Scss?&lt;/p&gt;

&lt;p&gt;Sass is itself carved into two types of syntaxes/file types: &lt;code&gt;.sass&lt;/code&gt; &amp;amp; &lt;code&gt;.scss&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sass&lt;/strong&gt; (Older syntax) was not quite accepted by a large audience. The reason was mostly because it's indent based instead of braces and it didn’t require semicolons, which increases the probability of human errors while writing.&lt;/p&gt;

&lt;p&gt;Where &lt;strong&gt;Scss&lt;/strong&gt; (New syntax) was widely accepted because it's quite similar to the way how we write CSS. Its kind of a win-win using Scss as we get to write stylesheets like CSS but we still get the benefits of Sass. Awesome!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;From now on, this article will assume that you understand Sass and well versed with its basics and practical usage, if not refer to &lt;a href="http://sass-lang.com/guide"&gt;this&lt;/a&gt; for more information.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Without further ado, let’s hop on the cool things we can use while writing scss:&lt;/p&gt;

&lt;h2&gt;
  
  
  Using variables as a selector
&lt;/h2&gt;

&lt;p&gt;We can define our selectors and use it in our stylesheets.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Define your base selector.&lt;/span&gt;
&lt;span class="nv"&gt;$header-base-class&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'.header'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$header-base-class&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to css&lt;/span&gt;
&lt;span class="nc"&gt;.header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, there could be a whole lot of use-cases where this can be super useful! Like umm.. in Media queries? Let’s go through it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nv"&gt;$small-only&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;640px&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Define&lt;/span&gt; &lt;span class="n"&gt;somewhere&lt;/span&gt; &lt;span class="n"&gt;else&lt;/span&gt; &lt;span class="n"&gt;like&lt;/span&gt; &lt;span class="n"&gt;maybe&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;_settings&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="nf"&gt;media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$small-only&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Here do your thing, the styles will only be applied to viewport &amp;lt; $small-only breakpoint.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Easy-peasy right? 😃&lt;/p&gt;

&lt;p&gt;Now you don’t have to define a hardcoded value in each of the media queries. Just change at one place like in this case &lt;code&gt;_settings.scss&lt;/code&gt; and get the results everywhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parent referencing using a prefix
&lt;/h2&gt;

&lt;p&gt;You must be familiar with &lt;code&gt;&amp;amp;&lt;/code&gt; ampersand prefix we generally use. This syntax generally allows you nest nested selector modifiers with reference to its parent.&lt;/p&gt;

&lt;p&gt;For example - You would like to change a div's background colour on hover.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nc"&gt;.highlight&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;red&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;// Compiles to css&lt;/span&gt;
&lt;span class="nc"&gt;.highlight&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;red&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But &lt;code&gt;&amp;amp;&lt;/code&gt; can also be used just as a prefix to reference its parent.&lt;/p&gt;

&lt;p&gt;Let’s say you have a base selector and want to apply particular style only when there is some specific class selector exists, usually, we tend to do something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nv"&gt;$base-item-selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'.base-selector'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$base-item-selector&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nt"&gt;--conditional-selector&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$base-item-selector&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nt"&gt;__details&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&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="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to css&lt;/span&gt;
&lt;span class="nc"&gt;.base-selector--conditional-selector&lt;/span&gt; &lt;span class="nc"&gt;.base-selector__details&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With Parent referencing prefix, we can modify it to be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$base-item-selector&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nt"&gt;--conditional-selector&lt;/span&gt; &lt;span class="k"&gt;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// See the usage of ampersand here&lt;/span&gt;
    &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nt"&gt;__details&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&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="c1"&gt;// This will also compiles to similar css.&lt;/span&gt;
&lt;span class="nc"&gt;.base-selector--conditional-selector&lt;/span&gt; &lt;span class="nc"&gt;.base-selector__details&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cool, right? Saved one depth and looks more organised.&lt;/p&gt;

&lt;h2&gt;
  
  
  Defining variables as defaults
&lt;/h2&gt;

&lt;p&gt;Using Sass, we can set variable precedence &amp;amp; scope with the help of &lt;code&gt;!default&lt;/code&gt; flag.&lt;br&gt;
Placing &lt;code&gt;!default&lt;/code&gt; at the end of declaration actually does the following things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you have defined a variable as &lt;code&gt;null&lt;/code&gt;, it will be considered unassigned and will be assigned with &lt;code&gt;!default&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If the variable is assigned some value already, then it will not be re-assigned.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Confused? ok, Let's talk it out.&lt;/p&gt;

&lt;p&gt;For instance, we have defined a text color as red, the normal process follows like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="c1"&gt;// _my-component.scss&lt;/span&gt;
&lt;span class="nv"&gt;$text-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;red&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;default&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$text-color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to css&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;red&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Makes sense so far, right? ok, let's continue. So, now you can override the colour while importing the component styling.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nv"&gt;$text-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;blue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="n"&gt;my-component&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to css&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;blue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What this means is &lt;code&gt;!default&lt;/code&gt; flag will only work if the values have not been already assigned/instantiated beforehand, otherwise it will be overridden.&lt;/p&gt;

&lt;p&gt;This is an important way of writing modular CSS. That’s why we tend to define most of our variables in a file for better accessibility. The &lt;code&gt;!default&lt;/code&gt; flag is very useful when using with mixins and plug-in type code.&lt;/p&gt;

&lt;p&gt;One more interesting example you can find &lt;a href="https://anotheruiguy.gitbooks.io/sassintherealworld_book-i/handy-tools/default-flag.html"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Mixins and Custom Functions
&lt;/h2&gt;

&lt;p&gt;Mixins and functions both exist in the same family because both accept variables as arguments but have somewhat different responsibilities. Let’s discuss one by one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mixins:&lt;/strong&gt; Mixins can accept arguments and do the required calculations you need but the output of a mixin would be a CSS rule.&lt;/p&gt;

&lt;p&gt;It will unfold itself when called with &lt;code&gt;@include&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For example, suppose we need to defined different typographies in our app. Then creating mixins would make more sense:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="c1"&gt;// _my-typography-rules.scss&lt;/span&gt;
&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;my-typography-small&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;.75rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;300&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;letter-spacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;.01em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// _my-component.scss&lt;/span&gt;
&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$base-selector&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;my-typography-small&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to&lt;/span&gt;
&lt;span class="nc"&gt;.base-selector&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;.75rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;300&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;letter-spacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;.01em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Functions:&lt;/strong&gt; Its very much similar to mixins but in case of output it returns a single value.  Just like we have custom functions in every other language, using custom functions in sass can be very healthy for your application.&lt;/p&gt;

&lt;p&gt;The Return value from a custom function can be of any data type. e.g. number, string, bool etc.&lt;/p&gt;

&lt;p&gt;One of the best example we have here is calculating rems based on a base unit size. We are using this quite extensively in our application and this is something which can be used anywhere. Very generic!&lt;/p&gt;

&lt;p&gt;Let's say, we are using rem unit with font sizes and everytime we use rem unit, we had to do manual computations. Sucks!! Isn't it?&lt;/p&gt;

&lt;p&gt;How we really calculate &lt;code&gt;rem&lt;/code&gt; is by dividing the target &lt;code&gt;size/base size&lt;/code&gt; = &lt;code&gt;your result&lt;/code&gt;. So the below function will give us the desired results and we can use it throughout our application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="c1"&gt;//_utility.scss&lt;/span&gt;
&lt;span class="cm"&gt;/**
 * Calculate rems based on a base unit.
 */&lt;/span&gt;
&lt;span class="k"&gt;@function&lt;/span&gt; &lt;span class="nf"&gt;remCalc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$size&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;$remSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$size&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nv"&gt;$font-base-size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;@return&lt;/span&gt; &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$remSize&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="n"&gt;rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// _my-component.scss&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;remCalc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;20&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$font-base-size&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope that now you get why Custom functions are really helpful as they help us avoid repeated computations. SCSS gives us a ton of inbuilt functions which you can have a look &lt;a href="http://sass-lang.com/documentation/Sass/Script/Functions.html"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s always best to check in-built function first rather than creating your own every other time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Default Arguments
&lt;/h2&gt;

&lt;p&gt;This is high time we talk about default arguments as we just wrapped up mixin and custom functions. They're kinda related.&lt;/p&gt;

&lt;p&gt;Mixins and custom functions both support arguments and icing on the cake is we can define default arguments as well.&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 scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;abc-with-margin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$y&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$z&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$margin&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Do your stuff with x, y, z.&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$margin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// _my-component.scss&lt;/span&gt;
&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$selector&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;abc-with-margin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;12&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;23&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;34&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to css&lt;/span&gt;
&lt;span class="nc"&gt;.selector&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Stuff we did with x,y,z.&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also override the default value. e.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="c1"&gt;// _my-component.scss&lt;/span&gt;
&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$selector&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;abc-with-margin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;12&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;23&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;34&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to css&lt;/span&gt;
&lt;span class="nc"&gt;.selector&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Stuff we did with x,y,z.&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Overridden.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Extending your selectors
&lt;/h2&gt;

&lt;p&gt;Using Scss, you can combine your selector's styles in the CSS output. As we inherit properties from the parent class or whatever, this is quite comparable to other programming languages but the process is very different. Again, the aim is to reuse different selector’s styles so that we do not have to rewrite the code which is already being used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nc"&gt;.menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.header-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@extend&lt;/span&gt; &lt;span class="nc"&gt;.menu&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to css&lt;/span&gt;
&lt;span class="nc"&gt;.menu&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.header-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.header-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we can see now &lt;code&gt;.header-menu&lt;/code&gt; has all the properties of &lt;code&gt;.menu&lt;/code&gt; plus the properties it already had. Traditional inheritance right? Now, whatever .menu will define it will be inherited by &lt;code&gt;.header-menu&lt;/code&gt; and can be easily overridden as well.&lt;/p&gt;

&lt;p&gt;You must be thinking, why can’t we just use mixins here and just get it over with, why another logic. I'll show you why not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If we go along with mixins:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grey&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.header-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;menu&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.footer-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;menu&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to css&lt;/span&gt;
&lt;span class="nc"&gt;.header-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grey&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.footer-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grey&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See how the last property is different and as soon as the amount of menu types increases will result in more and more repeated styles with each type of menu keeps on growing. This problem can be overcome by extending your selectors.&lt;/p&gt;

&lt;p&gt;Another advantage is it can be used with UI libraries such as foundation, bootstrap etc. One interesting read is how we can extend complex selectors &lt;a href="http://sass-lang.com/documentation/file.SASS_REFERENCE.html#extending_complex_selectors"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Placeholders
&lt;/h2&gt;

&lt;p&gt;We will take the help of a previous example, we just created a &lt;code&gt;.menu&lt;/code&gt; selector just so that child selectors can inherit styles. But what if the case is that this selector does not even exists or not being used anywhere but only through its child classes. We might as well get rid of it.&lt;/p&gt;

&lt;p&gt;Just to clarify few things before we move ahead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.menu&lt;/code&gt; is considered as a class.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;#menu&lt;/code&gt; is considered as id.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;%menu&lt;/code&gt; is considered as a placeholder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just so we don't get confused between these.&lt;/p&gt;

&lt;p&gt;This will result in same output as it was with the previous one.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nv"&gt;%menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.header-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@extend&lt;/span&gt; &lt;span class="nv"&gt;%menu&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.footer-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;@extend&lt;/span&gt; &lt;span class="nv"&gt;%menu&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;gray&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Compiles to css&lt;/span&gt;
&lt;span class="nc"&gt;.header-menu&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.footer-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.header-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.header-menu&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;gray&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only difference is that the menu has disappeared from the output as it was just a placeholder selector. This is really helpful because you are using the things which should only be outputted into the resulting CSS. For more information, read about placeholders &lt;a href="http://sass-lang.com/documentation/file.SASS_REFERENCE.html#placeholders"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Ok, Let’s wrap up. I wanted to cover Control directives in this as well, but that's a vast topic in itself. We will figure it out in my next blog. Stay tuned!&lt;/p&gt;

&lt;p&gt;Thanks for reading. 😃&lt;/p&gt;

&lt;p&gt;Visit my blog for the original &lt;a href="https://lhuria94.github.io/cool-things-you-can-do-with-sass-part-1/"&gt;post&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
      <category>sass</category>
      <category>scss</category>
      <category>frontend</category>
    </item>
  </channel>
</rss>
