<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Es2020 on David Lang</title>
    <link>https://www.davidlang.tech/tags/es2020/</link>
    <description>Recent content in Es2020 on David Lang</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sat, 28 Nov 2020 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.davidlang.tech/tags/es2020/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Modern JavaScript ES2020: Top Features You Should Know</title>
      <link>https://www.davidlang.tech/posts/modern-javascript-es2020-top-features-you-should-know/</link>
      <pubDate>Sat, 28 Nov 2020 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/modern-javascript-es2020-top-features-you-should-know/</guid>
      <description>&lt;p&gt;ECMAScript 2020 added practical features that reduce boilerplate and improve null-safety. If you are still avoiding optional chaining, now is the time to adopt it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;optional-chaining-and-nullish-coalescing&#34;&gt;Optional Chaining and Nullish Coalescing&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;const&lt;/span&gt; city &lt;span style=&#34;color:#719e07&#34;&gt;=&lt;/span&gt; user&lt;span style=&#34;color:#719e07&#34;&gt;?&lt;/span&gt;.address&lt;span style=&#34;color:#719e07&#34;&gt;?&lt;/span&gt;.city &lt;span style=&#34;color:#719e07&#34;&gt;??&lt;/span&gt; &lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#39;Unknown&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;?.&lt;/code&gt; short-circuits on &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;. &lt;code&gt;??&lt;/code&gt; returns the right side only when the left is &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;-unlike &lt;code&gt;||&lt;/code&gt;, it preserves &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;&#39;&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;bigint-and-globalthis&#34;&gt;BigInt and globalThis&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;BigInt&lt;/code&gt; handles integers beyond &lt;code&gt;Number.MAX_SAFE_INTEGER&lt;/code&gt;. &lt;code&gt;globalThis&lt;/code&gt; provides a standard way to access the global object in browsers and Node.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
