<?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 Thivagar Mahendran on Medium]]></title>
        <description><![CDATA[Stories by Thivagar Mahendran on Medium]]></description>
        <link>https://medium.com/@thivagartm?source=rss-ee9555f73657------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OD-sIgW8C8LI8Rq04-Ciqw.png</url>
            <title>Stories by Thivagar Mahendran on Medium</title>
            <link>https://medium.com/@thivagartm?source=rss-ee9555f73657------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 01:43:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thivagartm/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[How We built a Custom White Labeling Solution for Kaydoh Pages]]></title>
            <link>https://medium.com/kaydoh-connect/how-we-built-a-custom-white-labeling-solution-at-kaydoh-80b6cbd64d57?source=rss-ee9555f73657------2</link>
            <guid isPermaLink="false">https://medium.com/p/80b6cbd64d57</guid>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[system-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[nginx]]></category>
            <dc:creator><![CDATA[Thivagar Mahendran]]></dc:creator>
            <pubDate>Fri, 13 Mar 2026 02:12:03 GMT</pubDate>
            <atom:updated>2026-03-13T03:05:54.739Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve used Kaydoh, you know the platform lets you build landing pages to promote your listings and personal brand. For a long time, those pages lived under our domain. It worked fine — until our users started asking for something more.</p><p>They wanted their own domain names. Not a subdomain, not a branded URL with our name in it. Their domain, their brand, their identity. And honestly, they were right to ask. A page at <a href="http://www.mybusiness.com/"><strong>www.exampledomain.com</strong></a> just hits different than one sitting under someone else’s roof.</p><p>So we built it. A system that takes a user from “I want to use my own domain” to a fully live, HTTPS-secured website — automatically, without anyone on our team touching a single server. It took a while to get right, and we made some mistakes along the way. This is the story of how it works.</p><h3>What We Were Actually Building</h3><p>The pitch sounds simple: user gives us a domain, we make it work. But once you start pulling at that thread, the list of things you need to handle gets long fast.</p><p>You need to either register a brand new domain or accept one the user already owns. DNS records need to be configured to point at your infrastructure. You need an SSL certificate — and not one, but a unique certificate for every single domain. That certificate needs to be installed on a server that knows how to use it. Oh, and certificates expire, so you need to renew them automatically. And the whole thing needs to work without someone on-call babysitting it.</p><p>We spent a good chunk of time just mapping out what the workflow needed to look like before writing any code.</p><h3>The Four Layers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Qlh8R0ZBYjRuXeEH6VKtw.png" /><figcaption>Architecture Overview</figcaption></figure><p>We ended up with a design that breaks into four parts. Not because we sat down and said “let’s build four layers” — it just naturally fell out of the problem.</p><p><strong>The API layer</strong> is the front door. When a user checks if a domain is available or kicks off a registration, that request hits an API endpoint and lands in a serverless function. This is the only part of the system the user directly interacts with.</p><p><strong>The proxy layer</strong> is the workhorse. We run NGINX reverse proxy servers behind a load balancer. When someone types in a custom domain and hits enter, their request lands here. NGINX figures out which domain it is, terminates SSL with that domain’s certificate, and forwards the request to our application, which serves the right landing page. More on why we went with NGINX in a minute.</p><p><strong>The automation layer</strong> is the glue. Event-driven pipelines watch for things happening across the system — a new configuration created, a certificate provisioned — and automatically deploy changes to the proxy servers. No human in the loop.</p><p><strong>The data layer</strong> is the source of truth. A PostgreSQL database tracks where every domain is in its lifecycle. Certificates and credentials are stored securely. Configuration files sit in object storage. These aren’t just storage — they’re also event sources that feed the automation layer.</p><h3>Why NGINX?</h3><p>We get this question a lot, so let me just address it directly.</p><p>Each custom domain needs its own SSL certificate. That’s not optional — browsers don’t trust bare HTTP anymore, and a custom domain without HTTPS looks broken. The challenge is: how do you serve hundreds of different certificates from the same infrastructure?</p><p>NGINX handles this through SNI — Server Name Indication. When a browser connects over HTTPS, it sends the hostname it’s trying to reach as part of the TLS handshake, before the connection is even fully established. NGINX reads that hostname, picks the matching configuration, and uses the right certificate. One server, many domains, each with isolated SSL configs.</p><p>We also liked that NGINX gives us per-domain control. Every domain gets its own configuration that defines proxy behavior, SSL settings, and security rules. If something is broken on one domain, it doesn’t bleed into others.</p><p>And practically speaking, NGINX barely breaks a sweat under load. Its event-driven architecture handles thousands of concurrent connections without chewing through memory or CPU, which matters when you’re funneling all your custom domain traffic through a shared proxy fleet.</p><p>SSL termination happens at the NGINX layer, not at the load balancer. This was a deliberate choice — since each domain has its own certificate and NGINX needs to match the hostname to the right one, the proxy server is the right place to handle that. The load balancer simply routes traffic to healthy proxy instances.</p><h3>How a Domain Goes Live</h3><p>Here’s the actual sequence of what happens when a user connects a domain. I’m going to walk through it step by step because the handoffs between stages are where most of the interesting engineering lives.</p><p><strong>Registration and DNS.</strong> The user purchases a domain through us or tells us they’ve already got one. For purchases, we call the registrar’s API to register it and set the DNS records pointing to our proxy infrastructure. For imported domains, we tell the user exactly what records to set and wait for them to do it. Either way, our system generates an NGINX configuration tailored to the domain and stores it. The database records the domain as “pending DNS.”</p><p><strong>Config deployment.</strong> Once the configuration is created, our automation pipeline picks it up and deploys it to the proxy servers. This happens within seconds. The config is staged but not yet active — it references certificate files that don’t exist yet, so enabling it now would just break NGINX.</p><p><strong>DNS validation.</strong> A scheduled process checks every “pending DNS” domain and performs a lookup to see if it resolves to our infrastructure. DNS propagation is famously unpredictable — sometimes it’s instant, sometimes it takes hours. We just check periodically, and when it’s ready, we move the domain to “pending certificate.” No point fighting the DNS gods.</p><p><strong>Certificate provisioning.</strong> Another scheduled process picks up domains waiting for certificates. It talks to Let’s Encrypt using the ACME protocol to verify domain ownership and obtain a certificate. Once verified, the certificate is stored securely and ready for deployment.</p><p><strong>Certificate deployment.</strong> Once the certificate is stored, the automation pipeline detects it and deploys the certificate to the proxy servers. NGINX picks up the new domain configuration and starts serving traffic. A final step updates the database to mark the domain as “active.”</p><p>Done. The domain is live. The whole thing, from DNS propagating to HTTPS working, happens without anyone touching anything.</p><h3>The Scalability Problem We Didn’t See Coming</h3><p>Here’s a mistake we made early on that’s worth talking about.</p><p>In our initial design, every NGINX configuration and SSL certificate lived directly on each proxy server’s local disk. The automation pipelines would deploy files to the server, and that was that. It worked great — until we thought about what happens when a server dies.</p><p>Proxy servers aren’t permanent. They get replaced by the auto-scaling fleet. They can fail health checks. The cloud provider can retire the underlying hardware. When any of that happens, a fresh server spins up — and that fresh server has <em>nothing</em>. No configurations, no certificates, no idea which domains it’s supposed to serve.</p><p>With ten domains, this is annoying. With hundreds, it’s a real outage. Every single domain would go dark until the automation pipelines happened to re-run for each one. And those pipelines are event-driven — they fire when a <em>new</em> configuration or certificate is created, not when a server needs to be repopulated.</p><p>We solved this by centralizing our configuration and certificate storage so that it’s accessible to every proxy server in the fleet. Now when a new server comes up, it immediately has access to everything it needs. No re-deployment required, no waiting for anything to catch up.</p><p>This also simplified our deployment model. Instead of pushing changes to every individual server, the pipeline writes once and every server sees the change immediately.</p><p>It seems obvious in hindsight, but the local disk approach worked well enough during development and early usage that we didn’t feel the pain until we started thinking seriously about what failure recovery looks like at scale. If you’re building something similar, think about this on day one — it’s much easier to start with centralized storage than to migrate to it later.</p><h3>Certificate Renewal</h3><p>Let’s Encrypt certificates last 90 days. Forgetting to renew one means your user wakes up to a browser warning page telling their customers the site isn’t safe. Not acceptable.</p><p>We set up automated rotation so that before a certificate expires, the system goes through the same verification flow to obtain a fresh one. The updated certificate is stored, the automation pipeline picks up the change, and the proxy servers start using the new certificate. The whole cycle is hands-off.</p><p>We haven’t manually renewed a certificate since we built this. That was the goal.</p><h3>Why Event-Driven?</h3><p>Early in the design process, we considered building a single orchestrator — one function that handles the entire flow from registration to go-live. We’re glad we didn’t.</p><p>The event-driven approach means each stage is its own thing. A new configuration triggers deployment. A new certificate triggers installation. A schedule triggers DNS validation. These stages don’t know about each other, and they don’t need to.</p><p>This matters most when things fail. If one stage doesn’t work, we deal with <em>that stage</em>. We don’t re-register the domain or re-provision the certificate. Each stage is independently monitorable and independently debuggable. When we get an alert, we know exactly which stage has the problem without digging through a monolithic process log.</p><p>EventBridge is the thing that ties it all together. It watches for changes across the system and routes each event to the right handler. If you’re building workflows that span multiple AWS services, it’s a great fit for this kind of problem.</p><h3>Keeping It Running</h3><p>A few things we put in place to make sure we sleep well at night.</p><p>The proxy fleet runs across multiple data center zones. If one zone has issues, the load balancer routes around it. The fleet maintains the desired capacity and replaces failed servers automatically, which — thanks to centralized storage — come up ready to serve traffic immediately.</p><p>We have alerting on function error rates, unhealthy server counts, and certificate expiration timelines. Events that fail to process are captured so nothing gets silently dropped.</p><p>The scheduled processes that handle DNS validation and certificate provisioning also act as a consistency check. If a domain somehow got stuck in an intermediate state, the next scheduled run picks it up and pushes it forward. It’s a nice safety net that comes naturally with the polling approach.</p><h3>Security (Without the Details)</h3><p>I’ll stay high-level here because writing about your security setup in detail on a public blog would kind of defeat the purpose. But a few principles we stuck to:</p><p>Traffic goes through multiple filtering layers before reaching the application — firewall rules, bot detection, DDoS mitigation. Each one is a separate line of defense.</p><p>Every component can only communicate with the specific things it needs to. The proxy only accepts traffic from the load balancer. The database only accepts connections from the services that actually query it.</p><p>Every function and server runs with the minimum permissions it needs. We took the time to write scoped-down policies instead of reaching for broad defaults. It’s more work upfront, but it means a compromised component can’t do much damage.</p><p>All secrets are managed with rotation enabled. Nothing hardcoded, nothing sitting somewhere it shouldn’t be. The CloudFormation template resolves credentials dynamically at deploy time.</p><p>And the whole thing is Infrastructure as Code. One CloudFormation template, version-controlled, peer-reviewed. No one is making changes that aren’t tracked.</p><h3>What We’d Tell Someone Building This</h3><p><strong>Don’t underestimate DNS.</strong> It’s the one part of the system you can’t speed up or fully control. Build for it to be slow and unpredictable, and the rest of your design will be better for it.</p><p><strong>Think about server replacement on day one.</strong> Your system needs to handle “this server just disappeared and a blank one showed up” as gracefully as it handles the happy path. We learned this one the hard way, and fixing it after the fact was more work than it needed to be.</p><p><strong>Event-driven is worth the upfront investment.</strong> It takes longer to design than just writing one big function that does everything in sequence. But when something breaks at 2 AM, you’ll be really glad you can pinpoint the exact stage that failed and deal with just that.</p><p><strong>Automate certificate renewal from the start.</strong> Free certs from Let’s Encrypt combined with automated rotation means certificate management basically disappears from your operational burden. Don’t make it a follow-up task — bake it into the initial design.</p><h3>Where We Are Now</h3><p>Today, a Kaydoh user can connect a custom domain and have it fully live — HTTPS, correct routing, automatic renewal — without our team lifting a finger. The time from registration to a working site depends almost entirely on how fast DNS propagates, and everything after that takes minutes.</p><p>Honestly, the best measure of success for this system is that our users don’t think about it. They set up their domain, it works, and it keeps working. Behind the scenes, a web of events, automations, and serverless functions quietly makes sure it stays that way.</p><p>That’s the goal with infrastructure work, right? Build it well enough that nobody notices it’s there.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80b6cbd64d57" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kaydoh-connect/how-we-built-a-custom-white-labeling-solution-at-kaydoh-80b6cbd64d57">How We built a Custom White Labeling Solution for Kaydoh Pages</a> was originally published in <a href="https://medium.com/kaydoh-connect">Kaydoh Connect</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Kaydoh handles file uploads]]></title>
            <link>https://medium.com/kaydoh-connect/how-kaydoh-handles-file-uploads-f1ef47f472ce?source=rss-ee9555f73657------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1ef47f472ce</guid>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[s3-bucket]]></category>
            <dc:creator><![CDATA[Thivagar Mahendran]]></dc:creator>
            <pubDate>Wed, 28 Feb 2024 05:03:06 GMT</pubDate>
            <atom:updated>2024-02-29T19:41:26.041Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Kaydoh Dashboard handles file uploads</h3><h4>Implementation of file management in Kaydoh Dashboard</h4><h3>Introduction</h3><p>Kaydoh is a product that enables its customers to showcase their portfolios and listings to their clients distinctively and compellingly, which helps them stand out and close more deals. Our application offers many intuitive and practical features to make our customers unique among their clients. As a website builder, we receive many file uploads from our users daily, and file uploading has become an integral part of the core of Kaydoh.</p><h3>The Problem</h3><p>The problem started when we had a spike in active user count, and we experienced server downtimes occasionally. Before the surge in traffic, we had been running our Kaydoh API Server directly on a virtual machine. As stated, the number of daily active users had grown, causing our server to slow down and occasionally crash. After a thorough investigation, we discovered that the server crashed only when a file larger than (i.e:- &gt; 20 megabytes) was uploaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*47pcW7buTK0kAU6DhTOZYA.png" /><figcaption>Old Process Flow</figcaption></figure><p>As we started addressing this issue, we also identified that this could become a potential risk to our entire product ecosystem, resulting in poor user experience for our customers.</p><ul><li><strong>Security Risk </strong>— There could be vulnerable security breaches if the files are improperly handled.</li><li><strong>Lower Performance</strong> — The file size also impacts the performance, as larger files increase the CPU load. (We use an external library to manipulate images).</li><li><strong>Scalability</strong> — As the number of active users increases, we will have to scale out in server storage to ensure we have enough space to accommodate everyone’s needs.</li></ul><h3>The Solution</h3><p>Kaydoh operates entirely on the cloud, powered by Amazon Web Services as our vendor. We approached a challenge by simplifying the process and removing the need for our API servers to manage files before uploading them. Our initial step involved identifying a way to upload files to the S3 bucket without storing them on our servers. We narrowed down two possibilities to achieve this goal.</p><ol><li>Upload directly to S3 from the browser (Front-End).</li><li>Upload files using a pre-signed URL obtained from the destination S3 bucket.</li></ol><p>The <strong><em>first</em></strong> option mentioned above required exposing sensitive information such as <em>Secret</em> and <em>Access</em> <em>Key</em>. <strong><em>However, we can avoid exposing sensitive information using the pre-signed URL to upload the files directly</em></strong>. Therefore, we decided to go with the second option. To discuss how we implemented the solution, let&#39;s first see what pre-signed URLs are in AWS S3 and how one could utilize such a feature.</p><h4>What is a pre-signed URL?</h4><p>A pre-signed URL is merely an endpoint to access certain objects or upload objects to a specific S3 bucket in AWS. These URLs can be generated before and used later on several occasions. Below is an explanation extracted from <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/PresignedUrlUploadObject.html#:~:text=You%20may%20use,upload%20that%20object.">AWS Documentation</a>.</p><blockquote><em>Using a presigned URL will allow an upload without requiring another party to have AWS security credentials or permissions. A presigned URL is limited by the permissions of the user who creates it. That is, if you receive a presigned URL to upload an object, you can upload an object only if the creator of the URL has the necessary permissions to upload that object.</em></blockquote><p>As mentioned above, it perfectly satisfies our requirement of refraining from using AWS security credentials in our frontends directly. Also, this paved the way for us to implement a robust solution, including an authentication middleware before obtaining the pre-signed URL.</p><h4>The Architecture &amp; Implementation</h4><p>We first identified the necessary services to get started with file management in Kaydoh. The architecture was designed to simplify the implementation and reduce unnecessary steps.</p><ul><li><strong>Authenticator —</strong> We have added an authentication function to our API gateway that acts as a middle layer to ensure that only legitimate file upload requests from authenticated Kaydoh users are processed. This is done to prevent any unauthorized file upload attempts from unknown sources.</li><li><strong>Pre-Signed URL generator</strong> — This function was implemented to accept file upload requests, extract metadata from the files, and generate a pre-signed URL for the destination bucket.</li><li><strong>Thumbnail Generator</strong> — This service is crucial as it operates independently of our main servers and runs separately from our API.</li></ul><figure><img alt="Final Solution Architecture" src="https://cdn-images-1.medium.com/max/1024/1*GhRxgMiwZ90hSnp22n4P6g.png" /><figcaption>Architecture Design</figcaption></figure><p>As shown in the above image, the file uploads were being handled independently, and we could make this entire flow independent of our main servers. The flow was made very simple</p><ol><li>First, the user uploads a file, and the metadata from the file is extracted so the md5 hash can be generated and passed to the <strong><em>presignedUrlGenerator</em></strong> function(lambda) via API Gateway.</li><li><strong><em>presignedUrlGenerator </em></strong>function accepts payload with md5 content, which will be used to generate the pre-signed URL. The md5 hash is used here so that the file can be cross-checked when uploading the file using a pre-signed URL.</li><li>When the dashboard receives the signed URL, the file upload begins with a PUT request that includes the file as a payload and &#39;Content-MD5&#39; as a request header.</li><li>Once a file is uploaded to the s3 bucket, the bucket triggers an event to execute another lambda function responsible for generating the thumbnail (AWS Eventbridge is utilized here to automate the process). <em>i.e.:- When a PDF file is uploaded, this function will generate a thumbnail to be used as a preview.</em></li></ol><h3>Key Learnings</h3><p>We learned that making a small architectural change could greatly impress our customers on a larger scale. By maintaining a high CPU usage performance service independent of our main servers, we can minimize the need to run multiple instances of virtual machines or scale out in terms of storage.</p><p>Our main servers had to separate the thumbnail generation process due to the requirement of additional CPU for some files. Furthermore, it is observed that uploading and processing PDFs in large volumes consume a significant amount of CPU.</p><h3>Conclusion</h3><p>In summary, we were able to implement this and make it available for our customers in a shorter time. Although the design was simple, the impact was powerful. Initially, we wanted to be completely independent of our servers when handling files. By doing so, we were also able to improve our system’s overall performance and completely eliminate downtime caused by uploads. The file management feature has become more reliable and faster for our users.</p><blockquote>Learn more about Kaydoh <a href="https://www.kaydoh.com/">here</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1ef47f472ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kaydoh-connect/how-kaydoh-handles-file-uploads-f1ef47f472ce">How Kaydoh handles file uploads</a> was originally published in <a href="https://medium.com/kaydoh-connect">Kaydoh Connect</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Components in a Nutshell]]></title>
            <link>https://levelup.gitconnected.com/web-components-in-a-nutshell-1e114aa971b9?source=rss-ee9555f73657------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e114aa971b9</guid>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Thivagar Mahendran]]></dc:creator>
            <pubDate>Tue, 21 May 2019 11:26:36 GMT</pubDate>
            <atom:updated>2019-06-10T12:40:06.264Z</atom:updated>
            <content:encoded><![CDATA[<h4>Fundamentals of Native Browser Web Components and How to Create Them</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*farIT5K_01tofCXI8rQqTQ.png" /></figure><p>In web development, code reusability has become a strong focus. As a developer, we may have experienced a scenario where we had to use a code segment which represents custom UI controls in multiple places. If we fail to write them carefully, it may make our entire code structure unmanageable. Web components provide a native API to build reusable UI blocks.</p><h3>What are Web Components?</h3><p>Web components are a collection of <strong>lower-level browser APIs that helps us to create reusable, encapsulated custom HTML UI elements</strong>. Web components are considered much better because they can be created by using any library or framework, and you can start writing your own web component using vanilla JavaScript immediately.</p><p>One advantage of using web components is that they are available for all browsers except Microsoft Edge, but we don’t need to worry about it because we have <a href="https://github.com/webcomponents/webcomponentsjs">Polyfills </a>to resolve that issue.</p><p>Web components consist of three major technologies. They are the main pillars that can be used as APIs to build web components.</p><ul><li><strong>Custom Elements</strong></li><li><strong>Templates</strong></li><li><strong>Shadow DOM</strong></li></ul><p>Let’s take deep dive into these technologies.</p><h4>1. Custom Elements</h4><p>These are a set JavaScript APIs which help you to create HTML elements of your own and to control your DOM and its behaviour. We can build their hierarchy and dictate how they react to behavioural changes. For example, you can create an element like this &lt;my-element&gt;&lt;/my-element&gt;.</p><h4>2. Templates</h4><p>Templates are a user-defined markup that is only rendered upon the page load. Later these can be reused several times by creating an instance of the component.</p><h4>3. Shadow DOM</h4><p>The Shadow DOM is a combination of JavaScript APIs to connect with the encapsulated DOM. This will be rendered separately from the main Document Object Model and their behaviour features will be kept private so that the code segment will not collide with other parts of the code structure. The CSS and JavaScript can be isolated almost like an &lt;iframe&gt; tag using Shadow DOM.</p><h4>Lifecycle Callbacks</h4><p>Lifecycle callbacks are functions that are defined inside the custom element’s class definitions. They have their own uniquely defined purpose. They are used to manipulate the behaviour of our custom elements.</p><ul><li>connectedCallback: This particular function will be invoked when our custom element gets connected to the DOM initially.</li><li>adoptedCallback: This function will be called when our custom element has been moved to a new document.</li><li>attributeChangedCallback: If there is a change in our custom element’s attribute, such as an attribute being changed, added, or removed, this particular function will be invoked.</li><li>disconnectedCallback: This particular function is invoked when our custom element is disconnected from the DOM.</li></ul><p>Now Let’s see how we can create a web component using vanilla JavaScript. By doing this you will get a clear picture of web components.</p><h3>What we are going to build?</h3><p>We are going to build a web component that contains a current trending gif image. We are going to use the Giphy API to fetch the gif. Your code structure would look like this at the end of the implementation.</p><pre>--index.html<br>--card.js<br>--services.js</pre><h3>Let’s Get Started!</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F1TzKVQwH820wM%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2F1TzKVQwH820wM&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F1TzKVQwH820wM%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b56fda4922ebb0a4db6386d81403342/href">https://medium.com/media/7b56fda4922ebb0a4db6386d81403342/href</a></iframe><p>First, we must create a class that contains the behaviour of the web component that we are going to build. Create a file called card.js and create a class like below.</p><pre>class CardComponent extends HTMLElement {<br>    constructor (){<br>        super();<br>        <br>        //Your implementaion goes here<br>    <br>    }<br>}</pre><p>In the constructor of the class, you need to attach the shadow root of the Shadow DOM to the current HTML element of the document by using Element.attachShadow() method. Then we need to create an HTML template using &lt;template&gt;<em> </em>tag in our index.html file. The template would look something like this</p><pre>&lt;template id=&quot;card-view&quot;&gt;<br>   &lt;h1&gt;Web Component&lt;/h1&gt;<br>   &lt;p id=&quot;card-title&quot;&gt;Example&lt;/p&gt;<br>   &lt;img id=&quot;gif-view&quot;/&gt;<br>&lt;/template&gt;</pre><p>After adding this in our index.html file we can use DOM methods to clone the above template and attach it to our Shadow DOM. This should be written inside the constructor.</p><pre>class CardComponent extends HTMLElement {<br>    constructor (){<br>        super();<br>        const shadow =<em> this</em>.attachShadow({mode: &#39;open&#39;});<br>       <br>        <em>// Clone the template so that it can be attched to the <br>        shadowroot</em>                     <br>        const template = document.getElementById(&#39;card-view&#39;);<br>        const templateInstance = template.content.cloneNode(true);<br>        shadow.appendChild(templateInstance);<br>    }</pre><pre>}</pre><p>As I mentioned earlier, we should also write a function to fetch the gif from Giphy API. From the API we are going to get a current trending gif and its title provided by the uploader of that particular gif. Before we start writing the function, create a separate file called services.js to place the URL and API key. Create the file and add the following code with your API key from Giphy API</p><pre>const API_KEY = &#39;*YOUR_API_KEY*&#39;;</pre><pre>const url = `http://api.giphy.com/v1/gifs/trending?api_key=` + API_KEY + `&amp;limit=1`;</pre><pre>export {API_KEY, url}; // <em>export the url so that i can be used extrnally.</em></pre><p>After creating the services.js file, add the below code to your card.js file at the top so that you can use the URL to fetch the gif.</p><pre>import { url } from &#39;./services.js&#39;;</pre><blockquote>To get the API key of your own visit the following site. <a href="https://developers.giphy.com/">https://developers.giphy.com/</a></blockquote><p>Let’s jump back to our card.js file and add the following functions.</p><pre>render(shadowElem, data){<br>    const shadowRoot = shadowElem.shadowRoot;<br>    shadowRoot.getElementById(&#39;card-title&#39;).innerHTML = data.name;<br>    shadowRoot.getElementById(&#39;gif-view&#39;).src = data.url;<br>}<br></pre><pre>async fetchFromGiphy (){<br>  const res = await fetch(url);<br>  const json = await res.json();</pre><pre>  const gifUrl = json[&#39;data&#39;][&#39;0&#39;].images[&#39;fixed_height_small&#39;].url;<br>  const gifName = json[&#39;data&#39;][&#39;0&#39;].title;</pre><pre>  const gifObject = {<br>     name: gifName,<br>     url: gifUrl<br>  }<br>  return gifObject;<br>}</pre><p>Let me explain these functions.</p><p>fetchFromGiphy(): This function fetches the trending gif and the title of the specific gif and returns them both as an object using async/await.</p><p>render(): This function is used to inject the values inside the Shadow DOM’s elements.</p><p>Next, let’s have these functions be called in a lifecycle callback. Actually, we need the above two functions to be invoked when our custom elements connect to the DOM. We have the connectedCallback()<em> </em>function to achieve this.</p><pre>async connectedCallback (){<br>    <em>this</em>.gifObj = await<em> this</em>.fetchFromGiphy();<br>    <em>this</em>.render(<em>this</em>,<em> this</em>.gifObj);<br>}</pre><p>Finally, let’s define our custom element using the customElements.define()<strong><em> </em></strong>function. When defining a custom element there are some ground rules that we should keep in mind. The first parameter of the define()<em> </em>function should be a string which represents our custom element’s name. They can not be a single word, so it should have a - character in them. The second parameter would be our class object which defines the behaviour of our element.</p><pre>customElements.define(‘card-component’, CardComponent);</pre><p>Now that you have defined your component, add your card.js file to your index.html file. You can use the following element &lt;card-component&gt; anywhere in your HTML document. At the end of this journey, your index.html<strong><em> </em></strong>file would be like below.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;</pre><pre>&lt;head&gt;<br>&lt;title&gt;Web Component&lt;/title&gt;<br>&lt;/head&gt;</pre><pre>&lt;body&gt;<br>  <br>&lt;template id=&quot;card-view&quot;&gt;<br>    &lt;h1&gt;Web Component&lt;/h1&gt;<br>    &lt;p id=&quot;card-title&quot;&gt;Example&lt;/p&gt;<br>    &lt;img id=&quot;gif-view&quot;/&gt;<br>&lt;/template&gt;<br>  <br>&lt;card-component&gt;&lt;/card-component&gt;</pre><pre>&lt;script src=&quot;./card.js&quot; type=&quot;module&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>To run this, you need a server. Install static-server globally from your command line tool</p><pre>npm install -g static-server</pre><p>Run the static-server<strong><em> </em></strong>command from your workspace of the web component project.</p><pre>static-server</pre><p>Well, congratulations! You have your own component now.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fuj7WGWn5G9gwUv942i%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fjeopardy-2018-teen-tournament-uj7WGWn5G9gwUv942i&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fuj7WGWn5G9gwUv942i%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="263" frameborder="0" scrolling="no"><a href="https://medium.com/media/fbd0409afe4da9a8d871b644186d19d4/href">https://medium.com/media/fbd0409afe4da9a8d871b644186d19d4/href</a></iframe><h3><strong>Conclusion</strong></h3><p>This article summarizes the basics of web components. This is the theory and implementation of web components. Web components are incredibly useful since they help in code reusability. You can check out the whole code for this little project <a href="https://github.com/thivatm/web-comp">here</a>.</p><p><a href="https://gitconnected.com/learn/javascript">Learn JavaScript - Best JavaScript Tutorials (2019) | gitconnected</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e114aa971b9" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/web-components-in-a-nutshell-1e114aa971b9">Web Components in a Nutshell</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ionic Currency Converter]]></title>
            <link>https://levelup.gitconnected.com/ionic-currency-converter-8f33d3d76d2d?source=rss-ee9555f73657------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f33d3d76d2d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[ionic]]></category>
            <category><![CDATA[currency-conversion]]></category>
            <dc:creator><![CDATA[Thivagar Mahendran]]></dc:creator>
            <pubDate>Tue, 12 Feb 2019 12:55:27 GMT</pubDate>
            <atom:updated>2019-07-23T15:52:17.934Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let’s learn ionic by creating a simple real-world application.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dKKXkrZz1CJ6I7RAXvtvCA.png" /><figcaption>Credits: Pexels</figcaption></figure><p>I have been developing web applications using Angular recently. Since I decided to expand my knowledge not only in web development but also in mobile application development, I decided to build an app with the Ionic framework.</p><p>The reason I wanted to use Ionic is its all about <strong>JavaScript </strong>(I love JavaScript). Also Ionic follows the same concepts as in Angular.</p><ul><li>It has its own UI components structure as in Angular.</li><li>It uses TypeScript which is a superset of JavaScript.</li><li>It contains the features of Angular.</li></ul><p>Now let’s jump to the topic. You can not learn anything by reading or following tutorials. In order to learn any programming language or framework, you should try it out in the real world. That’s how I learn the fundamentals of any programming language. With all that said, I’m going to take you through an application that I wrote using the Ionic framework.</p><p>Lets’ build a simple currency converter.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl3dj09hpsfuYkijDi%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fthegoldbergs--1990-the-goldbergs-l3dj09hpsfuYkijDi&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fl3dj09hpsfuYkijDi%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f5a64391e018f6c2061cebc173ac305/href">https://medium.com/media/1f5a64391e018f6c2061cebc173ac305/href</a></iframe><h3>Assumptions</h3><p>This article assumes you have prior knowledge on</p><ul><li>Angular framework.</li><li>Typescript.</li></ul><p>I will not be covering all the fundamentals assuming that you have some basic knowledge in these technologies.</p><h3>Getting Started</h3><p>First things first, let’s create a blank ionic application. In your command line:</p><pre>npm install -g cordova ionic</pre><p>This command will install Ionic CLI which is a command line tool for Ionic. With this, you can create an ionic application with tabs with all the necessary files in your workspace folder. Create a folder where you want to maintain the workspace and open the command line from the location and execute (<em>I will be creating with tabs for future enhancements of the application</em>):</p><pre>ionic start &lt;name of the application&gt; tabs</pre><h3>Creating a Layout</h3><p>Let’s put a layout first so that we can start writing the functionality and services to fetch values from a free API which provides Currency rates instantly. Navigate to the following location in your project workspace and copy the code into the file.</p><pre><em>src/pages/home/home.html</em></pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9cf3293afe967ee93e6a625da140cba/href">https://medium.com/media/d9cf3293afe967ee93e6a625da140cba/href</a></iframe><p>Then let’s add some style to it! Go to:</p><pre><em>src/pages/home/home.scss</em></pre><p>And copy the below code into your file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3928481c02e8fdf3d2412c7fd083a499/href">https://medium.com/media/3928481c02e8fdf3d2412c7fd083a499/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*VeHkWPjZddVGZa7Nv65ErA.png" /></figure><p>To add icons to the tab bar let’s add the following tag in the index.html in the src folder ( <em>‘src/index.html ’</em> )</p><pre>&lt;link rel=”stylesheet” href=”https://use.fontawesome.com/releases/v5.6.3/css/all.css&quot; integrity=”sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/” crossorigin=”anonymous”&gt;</pre><p>Then add</p><pre>&lt;ion-tabs&gt;<br>&lt;ion-tab [root]=”tab1Root” tabIcon=”logo-usd”&gt;&lt;/ion-tab&gt;<br>&lt;ion-tab [root]=”tab2Root” tabIcon=”logo-bitcoin”&gt;&lt;/ion-tab&gt;<br>&lt;/ion-tabs&gt;</pre><p>in <em>tabs.html</em> which is located inside <em>‘ src/pages/tabs/tabs.html’ </em>and then let’s delete one extra tab.</p><h3>Creating Service class</h3><p>After creating the skeleton let’s get to the real work. We need a way to fetch currency rates. No need to worry, there are APIs which provides them to you for free on certain limits. Here’s is the one I’m using for this project.</p><pre><a href="https://free.currencyconverterapi.com/">https://free.currencyconverterapi.com</a></pre><p>If you go to this URL you may find instructions on fetching various kinds of data in JSON format. So how are we going to fetch the values is the real question. You may write the code for that directly in the <em>home.ts</em> file but that’s not a good practice at all. We have a solution for that which is services.</p><p>Services is a good practice because it reduces the code reusability very much and makes the code more generic and accessible from anywhere. So let’s create a service class now. In your <em>pages </em>folder create a folder named <em>services </em>and create a typescript file with whatever the name you like. In this project, I have named it as <em>cu-service.ts.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9200e3141cab2401bad2e4210d45e978/href">https://medium.com/media/9200e3141cab2401bad2e4210d45e978/href</a></iframe><p>A service class should be always exportable and Injectable. Now you may wonder what on earth is @Injectable. It is nothing but a dependency injection commonly used in Angular. @Injectable’s job is to identify it as a service class and this particular CurrencyService class will be available anywhere the class is imported.</p><p>Summary: We can use service classes anywhere in the code by making the class <em>Injectable</em>. If we take a look inside the class we have implemented two new functions called getCountries() and getExchangeRate()<strong><em>.</em></strong> In these two functions, we return the JSON data from those particular APIs and we are also going to return them as promises using toPromise()<em> </em>method. By default, the HttpClient<strong> </strong>returns observables from HTTP method calls but the reason to return them as <strong>promises </strong>is that the promises can make use of async/await functionality. Which helps us in writing asynchronous code in javascript.</p><ul><li>getCountries(): <em>Returns the list of countries with their CurrencyCode.</em></li><li>getExchangeRate(): <em>Returns the currency rate of two particular countries.</em></li></ul><p>When you are done creating the service class make sure you include it in the <strong>providers </strong>in <strong><em>app.module.ts </em></strong>file in the app folder<em>.</em></p><p>Using the promise that we return to the service class we can fetch the necessary data. In order to fetch them peacefully let’s use async/await.</p><h3>Implementation</h3><h4>Async/Await</h4><p>Using the asynchronous functions you can handle the unhandled errors from the promises smoothly using try/catch blocks. Async keyword can be written before a function, async makes sure that the function returns a promise and the function is executed asynchronously in the event loop. Using the await keyword inside the function, we can make the javascript wait until the promise that the function returns gets resolved.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e77ccabd3bf5b7936fea35836b86699/href">https://medium.com/media/9e77ccabd3bf5b7936fea35836b86699/href</a></iframe><p>Let me explain the code inside the home.ts file.</p><p>fetchCountries():<strong> </strong>This function<strong> </strong>gets the country list from the service and it will wait until the promise gets resolved since we have used <em>await </em>keyword in it. Using a for loop I am pushing every individual value from the JSON object that is returned and I am also pushing the currency names to a Map. By using a map we can have key-value pairs. Later we can get the currency names using the currency code which is the key in the Map.</p><p>getCurrencyRate(): Using this particular function we can fetch the currency rate for two specific currencies.</p><p>At the launch of the application in order to fetch the currency rate and the currency code list, we should call the above 2 functions inside the ngOnInit() function.</p><p>We are almost done now! All we have left to do is calculating the end result which is the currency value. To do that we have to add two more functions to the <em>home.ts</em> file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/03a559f2f348449ceb5172ed0758da05/href">https://medium.com/media/03a559f2f348449ceb5172ed0758da05/href</a></iframe><p>With these two functions being called we can instantly calculate the result value in both ways. Well, how do we do that? That’s what we are going to see next.</p><h4>Data Binding &amp; Event Binding</h4><p>Data binding is quite popular in web applications because it displays dynamic data which means it changes the value either triggered by the user or the application.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F69qqiZLVwD6vN8Phrw%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2F69qqiZLVwD6vN8Phrw&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F69qqiZLVwD6vN8Phrw%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b5de0ddce4717d45b54c514ef47a800/href">https://medium.com/media/1b5de0ddce4717d45b54c514ef47a800/href</a></iframe><p>We are going to use data binding and event binding to implement a currency converter as shown in the gif above. In the HTML layout, bind the variables that we created in the home.ts file using ngModel. By doing so whatever the value user inputs in the number field can be used dynamically. Also to trigger the events when the user enters a value in the input field we can use event binding. In this situation, the <a href="https://developer.mozilla.org/en-US/docs/Web/Events/keyup"><em>keyup</em></a><em> </em>event would help us. So let’s wrap that up with parenthesis and call the necessary functions. You can check the below code for help.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/75339e46eaec27d49103c49a711f40fd/href">https://medium.com/media/75339e46eaec27d49103c49a711f40fd/href</a></iframe><p>Additionally, I have included a card to showcase the currency rate and the currency names. Now to run this application in a browser run the below command in your terminal.</p><pre>ionic serve</pre><p>This will build the application and run in your default browser. You can check how this application looks like in all three platforms such as iOS, Android and Windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z27aeeP-Zsx8_G45YpTinw.png" /></figure><h3>Conclusion</h3><p>In this article, we tried to make this tutorial as simple as possible. Hope you learned something from this blog post. Please feel free to let me know if you encounter any issues or errors in the comments section.</p><blockquote>You can find the source code for this project in my <a href="https://github.com/thivatm/cu-conve">Github</a> handle.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f33d3d76d2d" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/ionic-currency-converter-8f33d3d76d2d">Ionic Currency Converter</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript ES10/ES2019 Features]]></title>
            <link>https://levelup.gitconnected.com/javascript-es10-es2019-features-d80c4fca6094?source=rss-ee9555f73657------2</link>
            <guid isPermaLink="false">https://medium.com/p/d80c4fca6094</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ecmascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[es-2019]]></category>
            <category><![CDATA[es10]]></category>
            <dc:creator><![CDATA[Thivagar Mahendran]]></dc:creator>
            <pubDate>Mon, 04 Feb 2019 08:41:22 GMT</pubDate>
            <atom:updated>2019-11-25T21:15:46.180Z</atom:updated>
            <content:encoded><![CDATA[<h4>New features of ES10/ECMAScript 2019</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QnhcYBM1I4reX_0PMo1vjw.png" /><figcaption>Credits: Pexels</figcaption></figure><p>Every year a new version of ECMAScript is released based on the proposals that have been accepted by the TC39 committee. Let’s have a look at the new features that were approved by the TC39 committee.</p><blockquote>In order to test these out, you need to update your chrome to v72</blockquote><h4>Object.fromEntries()</h4><p>In earlier versions of ECMAScript, you can use Object.entries() to make key-value pair arrays from an object. But now you can simply reverse the process by using <strong><em>Object.fromEntries()</em></strong><em>. </em>This will return a new object instantly with the key and values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*YrQzRkbcU1DXfXCfeb6mZg.png" /></figure><h4>String.prototype.trimStart() or trimEnd()</h4><p>We already have a feature <strong><em>trim()</em></strong> which helps us to avoid the blank spaces in a string. With the all-new <strong><em>trimStart() </em></strong>and <strong><em>trimEnd(), </em></strong>you get to choose which part of the string you have to avoid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*GATuFlEbctUrV_-yJRcVmQ.png" /></figure><p>I&#39;m using JSON.stringify() method to print and show the blank spaces in the console log.</p><h4>Well-formed JSON.stringify</h4><p>A new proposal has been submitted to prevent JSON.stringify from returning ill-formed Unicode strings. The proposed solution is to represent unpaired surrogate code points as JSON escape sequences rather than returning them as single UTF-16 code units.</p><pre>JSON.stringify(&#39;\uDF06\uD834&#39;); // → &#39;&quot;\\udf06\\ud834&quot;&#39;</pre><pre>JSON.stringify(&#39;\uDEAD&#39;); // → &#39;&quot;\\udead&quot;&#39;</pre><p>You can check the <a href="https://github.com/tc39/proposal-well-formed-stringify"><strong>tc39</strong></a> repository for more information on this.</p><h4>Array.prototype.flat()</h4><p>The <strong><em>flat()</em></strong> method would flatten a nested array up to a given value. By default, that value would be 1 if you don’t specify a value. By passing Infinity as a parameter inside the <strong><em>flat()</em></strong> it will recursively run infinite times and flattens the array to one single array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*RkEEBmegUb0qS3GqUJJ4gA.png" /></figure><h4>Array.prototype.flatMap()</h4><p>This is somewhat similar to Array.prototype.Map() but slightly different. However <strong><em>Array.prototype.flatMap()</em></strong> would give you a value pairs in one flatten array where <strong><em>Array.prototype.Map()</em></strong> would give value pairs in each different array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*rxK1GahfOp9-LMheUU0D3Q.png" /></figure><h4>Try/Catch Binding</h4><p>In this version of ECMAScript, we can have an optional binding for try/catch. In the earlier versions, we should implement the catch binding even if we don’t have to use it. With the new proposal, it allows us to remove the catch binding if we don’t have to use it.</p><pre>try {<br>   throw new Error(&#39;I am an error!&#39;);<br>}catch(error) {<br>   console.log(error);<br>}</pre><p>This has been changed in the new proposal and we can use the try/catch like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*UkZzRFcU0NzOtjC_xazPkg.png" /></figure><h4>Function.prototype.toString() revised</h4><p>Function.prototype.toString() has been revisioned in the new proposal. In earlier versions of ECMAScript, you can print the source code of the function using <strong><em>toString()</em></strong><em> </em>but there was a drawback that it will remove all extra white spaces and comments. In the new proposal, it has been retained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*G1k9LacEQaLuGxs_XyyVDw.png" /></figure><p>The output will be something like below:</p><pre>function <em>/* Adds numbers */</em>  addNumbers (<em>x</em>) {<br>  let y = x + 5;<br>  return y;</pre><pre>}</pre><h4>Symbol.description getter</h4><p>When you create a Symbol you can specify a description for the symbol for debugging purposes. In order to console.log() out the symbol description, you may have to convert it to string. But now with the new proposal, you can simply access the description by using Symbol.description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*V05v0AO5dKlkn-ZJW6zK8Q.png" /></figure><p>You can use the below links to find out more information on this.</p><ul><li><a href="https://github.com/tc39">TC39 Github Repo</a></li></ul><p><a href="https://gitconnected.com/learn/javascript">Learn JavaScript - Best JavaScript Tutorials (2019) | gitconnected</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d80c4fca6094" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/javascript-es10-es2019-features-d80c4fca6094">JavaScript ES10/ES2019 Features</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>