<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sakti Chourasia on Medium]]></title>
        <description><![CDATA[Stories by Sakti Chourasia on Medium]]></description>
        <link>https://medium.com/@shakcho?source=rss-6e44715d518c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2nXmyB8ogsSbscA9ASAOmA.jpeg</url>
            <title>Stories by Sakti Chourasia on Medium</title>
            <link>https://medium.com/@shakcho?source=rss-6e44715d518c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 08:59:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shakcho/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[JavaScript (TC39) Proposals]]></title>
            <link>https://medium.com/@shakcho/javascript-tc39-proposals-605faa208c13?source=rss-6e44715d518c------2</link>
            <guid isPermaLink="false">https://medium.com/p/605faa208c13</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tc39]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Sakti Chourasia]]></dc:creator>
            <pubDate>Tue, 02 Oct 2018 20:01:30 GMT</pubDate>
            <atom:updated>2019-09-15T20:41:10.897Z</atom:updated>
            <content:encoded><![CDATA[<p>Some of the new features which we may encounter in the future version of JS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_XZk-_lcA1XNpP4mKqTICw.jpeg" /></figure><p>Here are some of the new features coming to JavaScript, most of them are stage 0 or 1. Read the reference materials to know more about it. Some of the syntax might change when it actually be part of JavaScript. Read the docs before using it in production.</p><h4>1. Null Coalescing Operator</h4><pre>//instead of<br>const itemLength = data.item &amp;&amp; data.item.length;</pre><pre>// we can write <br>const itemLength = data.item?.length</pre><pre>// or we can also do like this [note the &#39;.&#39; character]<br>let val = obj.data?.(arg)</pre><p>If the value is null, the return value will also be null.</p><p><strong>1.1 Special Case</strong></p><pre>// Current syntax<br>const value = obj.isValid || false<br>// Proposed syntax<br>const value = obj.isValid ?? false</pre><p>In the above code, propsed syntax will only check if the obj.isValid is null or undefined, not for any falsey value where as the older syntax will check for any falsey values. The new syntax will solve the problem when you want to initialize your variable with 0 or false or even an empty string.</p><p>Reference :</p><ol><li><a href="https://tc39.github.io/proposal-nullish-coalescing/">https://tc39.github.io/proposal-nullish-coalescing/</a></li><li><a href="https://docs.google.com/presentation/d/1m5nxTH8ifcmOlyaTmTuMAa1bawiGUyKJzQGlw-EVSKM/edit#slide=id.p">https://docs.google.com/presentation/d/1m5nxTH8ifcmOlyaTmTuMAa1bawiGUyKJzQGlw-EVSKM/edit#slide=id.p</a></li></ol><p>Github: <a href="https://github.com/tc39/proposal-nullish-coalescing">https://github.com/tc39/proposal-nullish-coalescing</a></p><h3><strong>2. JavaScript do Expression</strong></h3><p>Use conditional statements as expressions, instead of awkward nested ternaries, see code below. It does not have return statement. Last statement is the return statement.</p><pre>let x = do {<br>  if (foo()) { f() }<br>  else if (bar()) { g() }<br>  else { h() }<br>};</pre><p>Github: <a href="https://github.com/tc39/proposal-do-expressions">https://github.com/tc39/proposal-do-expressions</a></p><h3><strong>3. Pipeline operator</strong></h3><p>New |&gt; allows for greater readability when chaining several functions together.</p><pre>let result = exclaim(capitalize(doubleSay(&quot;hello&quot;)));<br>result //=&gt; &quot;Hello, hello!&quot;<br><br>let result = &quot;hello&quot;<br>  |&gt; doubleSay<br>  |&gt; capitalize<br>  |&gt; exclaim;<br><br>result //=&gt; &quot;Hello, hello!&quot;</pre><p>Reference: <a href="http://tc39.github.io/proposal-pipeline-operator/">http://tc39.github.io/proposal-pipeline-operator/</a></p><p>Github: <a href="https://github.com/tc39/proposal-pipeline-operator">https://github.com/tc39/proposal-pipeline-operator</a></p><h3><strong>4. replaceAll method</strong></h3><p>The String Object will now have a replaceAll method which can be used instead of using regex.</p><pre>//instead of<br>const value = urlString.replace(/\+/g, &quot;%2B&quot;)<br>//we can write<br>const value = urlString.replaceAll(&quot;+&quot;, &quot;%2B&quot;)</pre><h3><strong>5. lastItem index in array</strong></h3><p>Instead of using (arr.length — 1), now we can use lastItem in array to get the last element. The prior one has an issue if you are calling an empty array or any array object which is null or undefined. Now the lastItem will automatically handles those issues for you. For reading purpose also lastItem is good read instead of doing math for getting last element.</p><pre>// getter<br>var lastElement = arr.lastItem<br>// setter<br>arr.lastItem = &#39;updated value&#39;</pre><h3>6. Promise.try</h3><p>Promise.try is in stage 1. It is very same as Async IIFE.</p><pre>//Promise.try<br>const p = Promise.try(async () =&gt; {<br>    //<br>});</pre><pre>// old way<br>const p = Promise.resolve().(async () =&gt; {<br>    // This will run in microtask<br>});</pre><pre>// Promise.try implementation<br>Promise.try = function(callback){<br>     return new Promise( resolve =&gt; {<br>         resolve(callback());<br>     });<br>}</pre><p>Reference : <a href="https://tc39.github.io/proposal-promise-try/">https://tc39.github.io/proposal-promise-try/</a></p><p>Github: <a href="https://github.com/tc39/proposal-promise-try">https://github.com/tc39/proposal-promise-try</a></p><p>To know more about microtask read <a href="https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/">this</a> article by Jake.</p><h3>7. Promise.allSettled</h3><p>Currently you would need to iterate through the array of promises and return a new value with the status known (either through the resolved branch or the rejected branch.</p><pre>function reflect(promise) {<br>  return promise.then(<br>    (v) =&gt; {<br>      return { status: &#39;fulfilled&#39;, value: v };<br>    },<br>    (error) =&gt; { <br>      return { status: &#39;rejected&#39;, reason: error };<br>    }<br>  );<br>}</pre><pre>const promises = [ fetch(&#39;index.html&#39;), fetch(&#39;https://does-not-exist/&#39;) ];<br>const results = await Promise.all(promises.map(reflect));<br>const successfulPromises = results.filter(p =&gt; p.status === &#39;fulfilled&#39;);</pre><p>The proposed API allows a developer to handle these cases without creating a reflect function and/or assigning intermediate results in temporary objects to map through:</p><pre>const promises = [ fetch(&#39;index.html&#39;), fetch(&#39;https://does-not-exist/&#39;) ];<br>const results = await Promise.allSettled(promises);<br>const successfulPromises = results.filter(p =&gt; p.status === &#39;fulfilled&#39;);</pre><p>Github: <a href="https://github.com/tc39/proposal-promise-allSettled">https://github.com/tc39/proposal-promise-allSettled</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=605faa208c13" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS variables AKA Custom Properties]]></title>
            <link>https://medium.com/@shakcho/css-variables-aka-custom-properties-bc2fe80f70ed?source=rss-6e44715d518c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc2fe80f70ed</guid>
            <category><![CDATA[css3]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[Sakti Chourasia]]></dc:creator>
            <pubDate>Tue, 02 Jan 2018 18:46:57 GMT</pubDate>
            <atom:updated>2019-09-15T20:43:36.593Z</atom:updated>
            <content:encoded><![CDATA[<p>A big and complex website has a very large amount of CSS. This can be due to different teams working on different modules, may be unaware of commonly usable code. As a codebase grows, it becomes difficult to maintain such a big CSS codebase for the UI developers.</p><p>In the meantime to the rescue of this problem CSS preprocessors came in to picture to make CSS code DRY(Don’t Repeat Yourself). One of the popular CSS preprocessors that I personally liked is SASS (Syntactically Awesome Stylesheet) especially the SCSS variant and one of the awesome features of the preprocessors are using the variable in your CSS. In the meantime, CSS3 came up with CSS variables AKA custom properties.</p><p>As described in <a href="https://developer.mozilla.org/en-US/">MDN</a>, CSS Variables are entities defined by CSS authors which contain specific values to be reused throughout a document.</p><p>They are set using custom property notation (e.g. — main-color: black;) and are accessed using the var() function (e.g. color: var( — main-color);)</p><p>So now we have to decide, whether to use the CSS3 variables or SASS variables. Don’t worry I will go deep into this topic and try to find out which helps us the most.</p><p>The very first thing that comes to mind about SASS variables is, that they are static, which actually means, they just replace the value of the variable during the compilation wherever the variable is used. Since the preprocessor doesn’t run on the browser, SASS variables don’t understand the DOM structure. On the other hand, CSS variables are flexible. They use the cascading feature of the CSS, and they can be inherited and scoped to selectors.</p><p>Enough talking about it, let’s see some of the examples.</p><pre>:root { <br>     /* This varibales are scoped to the root level */<br>     — color-primary: #444444;<br>     — color-secondary: #5555555;<br>}<br>body{<br>    color: var( — color-primary);<br>}<br>header{<br>    color: var( — color-secondary);<br>}</pre><p>We can use our variable to create new variable something like</p><pre>:root {<br>    - gradient: var( — color-bg-light),var( — color-bg-dark);<br>}</pre><p>now we can use it as</p><pre>div.hero{<br>    background-image: linear-gradient( var( — gradient));<br>}</pre><p>Till this point whatever we have learned it can be achieved using SASS variable also, but here comes the fun part of using CSS variables.</p><ol><li>CSS variables can be cascaded like</li></ol><pre>:root {<br> — font-size-primary: 1.2 em;<br>}</pre><pre>@media ( min-width : 576 px) {<br>     — font-size-primary: 1em;<br>}</pre><p>2. We can also do the calculation on CSS variables</p><pre>:root { <br>     — gutter: 2 ;<br>}<br>.img-hero{<br>     margin-top: calc ( var ( — gutter) * 10px); <br>}</pre><p>And the best feature is we can also modify CSS variable in Javascript using <strong>getPropertyValue()</strong> and <strong>setPropertyValue(). </strong>I will discuss about it on my<strong> </strong>next tutorial.</p><p>We have seen where is CSS variable works, but let us discuss a bit where it doesn’t work.</p><ol><li>CSS variable will not work in media query values like</li></ol><pre>@media ( min-width: var ( — break-point-value))</pre><p>2. we can’t use it as a selector or property name like</p><pre>/* Not allowed */<br>— my-selector : div.hero;<br>— my-property : font-size;</pre><pre>var( — my-selctor ){<br>   …<br>}<br> <br>body{<br>   var ( — my-property) : 10px;<br>}</pre><p>So now you have enough knowledge of CSS variables to get started. Please check the <a href="http://caniuse.com/">caniuse.com</a> to before using it in production, and let me know your thought on this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc2fe80f70ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Youtube is getting Material Design makeover]]></title>
            <link>https://medium.com/@shakcho/youtube-is-getting-material-design-makeover-c5682b45d449?source=rss-6e44715d518c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5682b45d449</guid>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[youtube]]></category>
            <dc:creator><![CDATA[Sakti Chourasia]]></dc:creator>
            <pubDate>Mon, 02 May 2016 13:14:19 GMT</pubDate>
            <atom:updated>2016-05-03T07:11:19.239Z</atom:updated>
            <content:encoded><![CDATA[<p>Google is trying to roll out <a href="https://design.google.com/">Material Design</a> for all of its products, So why not Youtube. As the date is not decided when will all the youtube users going to get to see the new UI of Youtube which is looks like the image given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wVeupzJr5BrZYRmvCmV8dg.png" /></figure><p>So here is how you can view the youtube in it’s new makeover.</p><ol><li>go to <a href="http://www.youtube.com/?gl=US">http://www.youtube.com/?gl=US</a></li></ol><p>2. Open the developer tools(Ctrl + Shift + i)</p><p>3. go to ‘Resources’ tab in the developer tools and move to cookie section and open youtube.com from and delete ‘<em>VISITOR_INFO1_LIVE’ .</em></p><p>4. go to Console tab and paste the code</p><blockquote><em>document.cookie=”VISITOR_INFO1_LIVE=Qa1hUZu3gtk;path=/;domain=.youtube.com”;</em></blockquote><p>and hit refresh and you can see the new UI of youtube.</p><h4>NOTE: Please Use Google Chrome browser otherwise it will not work.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5682b45d449" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>