<?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: Andrei Bumbu</title>
    <description>The latest articles on DEV Community by Andrei Bumbu (@andreib123).</description>
    <link>https://dev.to/andreib123</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%2F190015%2F70502319-0339-4e41-815b-24efca8fa36a.jpeg</url>
      <title>DEV Community: Andrei Bumbu</title>
      <link>https://dev.to/andreib123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/andreib123"/>
    <language>en</language>
    <item>
      <title>PWA Overview in 6 minutes (part 1)</title>
      <dc:creator>Andrei Bumbu</dc:creator>
      <pubDate>Thu, 22 Aug 2019 16:40:41 +0000</pubDate>
      <link>https://dev.to/andreib123/pwa-overview-in-6-minutes-part-1-nn1</link>
      <guid>https://dev.to/andreib123/pwa-overview-in-6-minutes-part-1-nn1</guid>
      <description>&lt;p&gt;Here it is, a favorite technical topic of mine, &lt;strong&gt;Progressive Web Apps&lt;/strong&gt;. The target is to write &lt;em&gt;a series of articles&lt;/em&gt; related to PWAs, so let me know if you &lt;strong&gt;struggled&lt;/strong&gt; to understand/implement any of the functionalities.&lt;/p&gt;

&lt;p&gt;Maybe you heard about this &lt;em&gt;(becoming)&lt;/em&gt; buzzword from Google events or some random articles on the internet. If you don’t, it’s ok, we will start from the &lt;strong&gt;beginning&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In the past months, I delivered &lt;strong&gt;two presentations&lt;/strong&gt; on PWAs with an aggregated attendance of over &lt;strong&gt;50 people&lt;/strong&gt;. The focus was on two directions, first &lt;em&gt;(tied to this article)&lt;/em&gt;, to present &lt;strong&gt;what&lt;/strong&gt; are PWAs and &lt;strong&gt;why&lt;/strong&gt; they are useful and second, to implement live a PWA from scratch &lt;em&gt;(future articles)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;You will discover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What&lt;/strong&gt; PWAs are 📳&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;benefits&lt;/strong&gt; you can get from them 👍&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Production PWAs examples with &lt;strong&gt;statistics&lt;/strong&gt; 📈&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PWA &lt;strong&gt;characteristics&lt;/strong&gt; 📝&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But first, &lt;strong&gt;important&lt;/strong&gt; notice &lt;em&gt;(if never used a PWA)&lt;/em&gt;! Go to &lt;a href="http://www.twitter.com" rel="noopener noreferrer"&gt;www.twitter.com&lt;/a&gt; from Chrome and click on the menu &lt;strong&gt;“Install Twitter”&lt;/strong&gt; or from your Android device and click &lt;strong&gt;“Add to Home screen”&lt;/strong&gt; pop-up. If you are an Apple user tap &lt;strong&gt;“Share”&lt;/strong&gt; and then &lt;strong&gt;“Add to Homescreen”&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The target is to really &lt;strong&gt;see PWA in action&lt;/strong&gt; before the information from this article.&lt;/p&gt;

&lt;p&gt;Let’s go!  &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%2Flh3.googleusercontent.com%2FdU8xyqdwbOH9V3FR2Jm8FqwJp4zXY68HENj7k3PcEJw82fwtNGNmbnjiKqkxwaeR4Dd68k2etjDt" 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%2Flh3.googleusercontent.com%2FdU8xyqdwbOH9V3FR2Jm8FqwJp4zXY68HENj7k3PcEJw82fwtNGNmbnjiKqkxwaeR4Dd68k2etjDt" title="PWA Overview Banner" alt="enter image description here"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are PWAs
&lt;/h2&gt;

&lt;p&gt;Based on what Google says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Progressive Web Apps are &lt;strong&gt;websites&lt;/strong&gt; built using web technologies but&lt;br&gt;
&lt;strong&gt;act and feel like an app&lt;/strong&gt;.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The main idea from this definition is that you can develop a &lt;strong&gt;web application&lt;/strong&gt; from scratch or even &lt;strong&gt;upgrade&lt;/strong&gt; an existing one with some functionalities that make it &lt;strong&gt;behave like a native app&lt;/strong&gt;. &lt;em&gt;(mobile or desktop)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And now a more casual explanation:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Progressive Web Apps are just &lt;strong&gt;websites&lt;/strong&gt; that took all the right&lt;br&gt;
vitamins.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Therefore PWA can be seen as an upgrade of a web application in order to serve the &lt;strong&gt;new needs of the users&lt;/strong&gt; worldwide. Over &lt;strong&gt;50%&lt;/strong&gt; of the internet traffic it’s from mobile devices, so your web application should &lt;em&gt;do more than responsiveness&lt;/em&gt; in order to adapt.&lt;/p&gt;

&lt;h2&gt;
  
  
  PWA Checklist
&lt;/h2&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%2Flh3.googleusercontent.com%2F-6yZclFn_Ht_z7okPMLsES3aarCiEyKdetTaRNMqoWzHH-SoAUAGr9YVyxAAHjD0YFN2cDjCstRO" 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%2Flh3.googleusercontent.com%2F-6yZclFn_Ht_z7okPMLsES3aarCiEyKdetTaRNMqoWzHH-SoAUAGr9YVyxAAHjD0YFN2cDjCstRO" title="PWA Checklist" alt="enter image description here"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTPS - Secure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Any PWA should be served over &lt;strong&gt;HTTPS&lt;/strong&gt;. If this requirement it’s not respected, your application will not be Progressive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connectivity Independent&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your web application should support weak networks and also offline support. Both functions can be achieved using service workers and caching.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;App-like&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The structure of the application should have the &lt;strong&gt;aspect&lt;/strong&gt; of a native one. For that, we can load the &lt;strong&gt;app shell&lt;/strong&gt; the first time, using service workers, and load it on the next visit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Discoverable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Being a web application can be found by &lt;strong&gt;searching engines&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Re-engageable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The main functionality of the mobile application that engages users is &lt;strong&gt;push notifications&lt;/strong&gt;. With service workers, you can implement those for your PWA and use them anywhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fresh&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The application can be &lt;strong&gt;updated&lt;/strong&gt; with new functionalities using service workers &lt;em&gt;(background-sync)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Responsive&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Of course, the application should be &lt;strong&gt;responsive&lt;/strong&gt; and behave nicely on any type of screen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your application can be &lt;strong&gt;installed&lt;/strong&gt; through the browser and behaves like a native one afterward.&lt;/p&gt;

&lt;h2&gt;
  
  
  Case Studies
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1.  Twitter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s start with Twitter's situation:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“With over &lt;strong&gt;80%&lt;/strong&gt; of users on mobile, Twitter wanted their mobile web&lt;br&gt;
experience to be faster, more reliable, and more engaging. “&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Twitter implemented a PWA version of their application and managed to make it &lt;strong&gt;the most used client&lt;/strong&gt;. The application had a lot of success on desktop also.&lt;/p&gt;

&lt;p&gt;Here are some &lt;strong&gt;statistics&lt;/strong&gt; that they presented:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Increased the pages per session with &lt;strong&gt;65%&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Increased the tweets sent by &lt;strong&gt;75%&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Decreased by &lt;strong&gt;20%&lt;/strong&gt; the bounce rate&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a tremendous success for them, taking into consideration the &lt;strong&gt;volume&lt;/strong&gt; of their users.&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%2Flh3.googleusercontent.com%2FDiL7ioN3ohYsR9FGQKOuMsBtsi4XaH3aLNdtkOVx_KuqAiN5hhXMgQXjKe3lr43tnyxM-kv_8KdM" 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%2Flh3.googleusercontent.com%2FDiL7ioN3ohYsR9FGQKOuMsBtsi4XaH3aLNdtkOVx_KuqAiN5hhXMgQXjKe3lr43tnyxM-kv_8KdM" title="Twitter UI" alt="Twitter UI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.  Pinterest&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pinterest observed a problem of their web application, as they declared:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Pinterest noticed its website experience was slow and converted only&lt;br&gt;
&lt;strong&gt;1%&lt;/strong&gt; of all visitors into sign-ups or mobile app installs. This led them&lt;br&gt;
to develop a Progressive Web App.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After their PWA implementation they also had some valid &lt;strong&gt;statistics&lt;/strong&gt; to share:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Increased time spent on the mobile web by &lt;strong&gt;40%&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;  Increased user-generated ads revenue by &lt;strong&gt;44%&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;  Increased engagement with &lt;strong&gt;60%&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The most important one from them, in my perspective, is the &lt;strong&gt;revenue one&lt;/strong&gt;. That demonstrates that this technology can be applied successfully in a large organization and have a positive &lt;em&gt;impact on the business/revenue side&lt;/em&gt;.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FdBcTZnU68ggx461SDT9xyunDVEXveADTXzJgzBJWUcvBeTh38Ys85FUybrPrFmKLLlj0RKmt1aD9" 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%2Flh3.googleusercontent.com%2FdBcTZnU68ggx461SDT9xyunDVEXveADTXzJgzBJWUcvBeTh38Ys85FUybrPrFmKLLlj0RKmt1aD9" title="Pinterest UI" alt="Pinterest UI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Characteristics
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1.  Fast loading&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Google says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“&lt;strong&gt;53%&lt;/strong&gt; of users will abandon a site if it takes longer than 3 seconds to&lt;br&gt;
load!”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Having that information in mind, an important aspect of PWAs is to be fast and reliable. A particular method to achieve that speed is to &lt;strong&gt;cache the app shell&lt;/strong&gt;, using the service workers.&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%2Flh3.googleusercontent.com%2FQD_B390MSM0OTVQXX1hh6aeAOb2HTjWYJkUsocbg19X90tPgxR2-MA1bbsAzL2KFM53TcF3RS2sK" 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%2Flh3.googleusercontent.com%2FQD_B390MSM0OTVQXX1hh6aeAOb2HTjWYJkUsocbg19X90tPgxR2-MA1bbsAzL2KFM53TcF3RS2sK" title="Service Worker example1" alt="Service Worker example1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are represented some simple &lt;strong&gt;network requests&lt;/strong&gt;. When an user opens the application, the shell can be &lt;strong&gt;served directly&lt;/strong&gt; from the service worker, who can intercept any network request sent from the browser.&lt;/p&gt;

&lt;p&gt;The benefit is that the user gets &lt;strong&gt;fast feedback&lt;/strong&gt; before all the resources were loaded.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2F3bsxtz3t2TAU9dm0LQ6HHh4eLcvcs64nYakaRVIUKr7Dxho2ZB3_BlcIVgGVhJDbh5M63716mCZv" 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%2Flh3.googleusercontent.com%2F3bsxtz3t2TAU9dm0LQ6HHh4eLcvcs64nYakaRVIUKr7Dxho2ZB3_BlcIVgGVhJDbh5M63716mCZv" title="Service Worker example2" alt="Service Worker example2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another good strategy is to let the service worker do the business-related &lt;strong&gt;data request&lt;/strong&gt; at the start and until the app shell is drawn by the browser, the content could be ready to be loaded. In this example case, the time is reduced to &lt;strong&gt;almost half&lt;/strong&gt;, which represents a huge difference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.  Installable&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“Add to Home Screen&lt;/strong&gt;, sometimes referred to as the web app install&lt;br&gt;
prompt, makes it easy for users to install your Progressive Web App on&lt;br&gt;
their mobile or desktop device.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What it does, it adds a &lt;strong&gt;shortcut&lt;/strong&gt; to your screen from where you can start the application in a &lt;strong&gt;separate process&lt;/strong&gt;, not directly on the browser. It works both on mobile and desktop, but the main target is the mobile audience.&lt;/p&gt;

&lt;p&gt;A PWA can be installed from Safari, but it will need &lt;strong&gt;two additional touches&lt;/strong&gt;, going through the menu. A workaround for this can be a custom &lt;strong&gt;implementation of a banner&lt;/strong&gt; similar to the one from Chrome, and implement the installation &lt;strong&gt;manually&lt;/strong&gt; in the back.&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2FfxkYF3JWgqmWsYDk71fh0_H4ZCS9bKcQCA6-hZn2Uky-zO2kNAIGGidIofOUy9MDzsomkPIyeSYP" 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%2Flh3.googleusercontent.com%2FfxkYF3JWgqmWsYDk71fh0_H4ZCS9bKcQCA6-hZn2Uky-zO2kNAIGGidIofOUy9MDzsomkPIyeSYP" title="Install PWA examples" alt="Install PWA examples"&gt;&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.  Multiple platforms&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PWAs can support multiple platforms &lt;em&gt;(browser, mobile, desktop)&lt;/em&gt; and will behave particularly to each one of them. Because nothing is perfect, there are some &lt;strong&gt;limitations&lt;/strong&gt; when we refer to &lt;strong&gt;Safari&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%2Flh3.googleusercontent.com%2FN7u_AIlV83xXhXKdWUyt2N3EZrDchK9lcLzOjRNsJCI5w7jrIp5FeU62x7X1YVaXYuYhnnbPmxUf" 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%2Flh3.googleusercontent.com%2FN7u_AIlV83xXhXKdWUyt2N3EZrDchK9lcLzOjRNsJCI5w7jrIp5FeU62x7X1YVaXYuYhnnbPmxUf" title="Browser comparation" alt="Browser comparation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yes, I know what you are thinking. It seems that PWA can be implemented only on Chrome or other non-Apple browsers, but the truth is &lt;strong&gt;somewhere in the middle&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Even if important functionalities like &lt;strong&gt;Push Notification&lt;/strong&gt; or &lt;strong&gt;Install Banner&lt;/strong&gt; aren’t supported for Safari, PWAs can still bring value to the Apple fans through the other benefits and with &lt;strong&gt;a couple of customizations&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.  Works offline&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Works offline it’s a &lt;strong&gt;bold&lt;/strong&gt; statement. It’s an objective for the PWAs, but you can implement just &lt;em&gt;some of the functions&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;For example, you can &lt;strong&gt;cache the app shell&lt;/strong&gt; and, if you have a platform similar to dev.to, cache also the &lt;strong&gt;visited articles&lt;/strong&gt; &lt;em&gt;(the data)&lt;/em&gt;. In this case, if the network is flakey or there is no connection at all, the user can still read the loaded articles.&lt;/p&gt;

&lt;p&gt;A more advanced feature could be to use &lt;strong&gt;“background sync”&lt;/strong&gt; to commit the offline user actions when the connection returns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.  Engaging&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;The engaging point is strongly attached to &lt;strong&gt;push notifications&lt;/strong&gt;. It’s the main feature that keeps the user interested in the application dynamically.&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%2Flh3.googleusercontent.com%2FjnK-xzVmfu-g4crRNCCWrfCzj12uOcl7_ldZcVbTtYKeyHzZjIjA1HZaz2lI3yTlwvuMytJnBanN" 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%2Flh3.googleusercontent.com%2FjnK-xzVmfu-g4crRNCCWrfCzj12uOcl7_ldZcVbTtYKeyHzZjIjA1HZaz2lI3yTlwvuMytJnBanN" title="Push Notification schema" alt="Push Notification schema"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above schema, it’s presented an example of an implementation for push notification into a PWA, using &lt;strong&gt;Google Cloud Messaging&lt;/strong&gt; &lt;em&gt;(GCM)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;First, you can ask the user if he &lt;strong&gt;agrees to receive notifications&lt;/strong&gt;. If the answer is positive, request the GCM for a &lt;strong&gt;token&lt;/strong&gt;, then store it into your server, tied to the device.&lt;/p&gt;

&lt;p&gt;When you want to send a &lt;strong&gt;notification&lt;/strong&gt; you can simply send a &lt;strong&gt;request&lt;/strong&gt; to GCM, using the token and some additional information, like the message or icons and GCM will send the notification to your device. Thanks to service workers, your client can &lt;strong&gt;understand&lt;/strong&gt; and &lt;strong&gt;display&lt;/strong&gt; the notifications.&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%2Flh3.googleusercontent.com%2FfxZ73S1VZMoS9w71i_pSm6XoyaoEOYnTsepbPI1n8IRiaOJKrAECGeUMG0k-Zy1cEMSPqpoLyLk0" 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%2Flh3.googleusercontent.com%2FfxZ73S1VZMoS9w71i_pSm6XoyaoEOYnTsepbPI1n8IRiaOJKrAECGeUMG0k-Zy1cEMSPqpoLyLk0" title="Conclusion Banner" alt="Conclusion banner"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was a &lt;strong&gt;high-level&lt;/strong&gt; article, that presents the main aspects of PWA. To fully understand PWAs, you need to research further. Leave a comment if you want to &lt;em&gt;write more on some specific topics&lt;/em&gt; related to PWAs.&lt;/p&gt;

&lt;p&gt;PWAs represents a fast approach to develop an application that &lt;em&gt;(almost)&lt;/em&gt; works on all platforms. If your use case can ignore the limitations, especially the ones related to iOS, it can be a great solution for your &lt;strong&gt;mobile-web dilemma.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Even if you don’t need a mobile application, adding the capability to &lt;strong&gt;install&lt;/strong&gt; and &lt;strong&gt;offline functions&lt;/strong&gt; into your web application can be a huge &lt;strong&gt;upgrade&lt;/strong&gt;. Those functionalities are the easiest to implement and I will present them in a future article.&lt;/p&gt;

&lt;p&gt;The main two problems with PWA are the &lt;strong&gt;iOS limitations&lt;/strong&gt; and the fact the *&lt;em&gt;users are not yet familiarized *&lt;/em&gt; witg a web application, as a PWA.&lt;/p&gt;

&lt;p&gt;It’s a technology in development, that has &lt;strong&gt;great potential&lt;/strong&gt; to solve the changes from the &lt;strong&gt;user's behavior&lt;/strong&gt; and I think it’s great to be aware of it. There may be cases where it’s the perfect fit.&lt;/p&gt;

&lt;p&gt;Let me know in the comments if you have any &lt;strong&gt;questions&lt;/strong&gt; or &lt;strong&gt;suggestions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>pwa</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>100 reactions at my first technical article - Tips and Insights
</title>
      <dc:creator>Andrei Bumbu</dc:creator>
      <pubDate>Mon, 12 Aug 2019 11:10:11 +0000</pubDate>
      <link>https://dev.to/andreib123/100-reactions-at-my-first-technical-article-tips-and-insights-g33</link>
      <guid>https://dev.to/andreib123/100-reactions-at-my-first-technical-article-tips-and-insights-g33</guid>
      <description>&lt;p&gt;So, if you are here it means that you considered at least once to &lt;strong&gt;&lt;em&gt;write an article&lt;/em&gt;&lt;/strong&gt; or you did it already. &lt;strong&gt;(or just curious)&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;The scope is to present my &lt;strong&gt;&lt;em&gt;“roadmap”&lt;/em&gt;&lt;/strong&gt; writing my first technical article, simply and funnily &lt;strong&gt;(I hope)&lt;/strong&gt; and give you the main elements that you need to do it yourself &lt;strong&gt;(or maybe improve your process)&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;My first technical article posted on the internet is named &lt;strong&gt;&lt;em&gt;&lt;a href="[https://dev.to/andreib123/6-javascript-wtfs-and-what-to-learn-from-them-406d](https://l.messenger.com/l.php?u=https%3A%2F%2Fdev.to%2Fandreib123%2F6-javascript-wtfs-and-what-to-learn-from-them-406d&amp;amp;h=AT2TYpN1yUgmrJA8ZHwKiTDUQ_eN3UNi1tXWlfqExEwrBkYtAiBoHqFOm1N-M5G9XZRSuqwbRJMI9AWLS54Fm7_FYfk_9P3VxueoCPw2ks2HvTrrbMzAnTH-6SeU9vOTqdjtdw)"&gt;“6 JavaScript WTFs and what to learn from them”&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. Check it out if you didn’t already and hit me with that juicy &lt;strong&gt;&lt;em&gt;feedback&lt;/em&gt;&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;Before we start, here are some things about me. I am a Romanian &lt;strong&gt;&lt;em&gt;Full-Stack&lt;/em&gt;&lt;/strong&gt; developer who worked for almost &lt;strong&gt;&lt;em&gt;3 years&lt;/em&gt;&lt;/strong&gt; in the field, interested in &lt;strong&gt;&lt;em&gt;web technologies&lt;/em&gt;&lt;/strong&gt;, especially in &lt;strong&gt;&lt;em&gt;ReactJS&lt;/em&gt;&lt;/strong&gt;, practice-oriented and keen to help others find their &lt;strong&gt;passion for programming&lt;/strong&gt; and &lt;strong&gt;improve their skills&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;The reason I wrote the previous article is tied to my medium term objective to create &lt;strong&gt;web oriented content for begginers&lt;/strong&gt;. &lt;em&gt;(and also to improve my skill down the road)&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;Why &lt;strong&gt;&lt;em&gt;write&lt;/em&gt;&lt;/strong&gt;? Three reasons:  &lt;/p&gt;

&lt;p&gt;First, you are giving back to the community and &lt;strong&gt;&lt;em&gt;help others&lt;/em&gt;&lt;/strong&gt;. For me, this is the greatest motivator, it fills me. &lt;strong&gt;(if this is not you, bare with me for the next two reasons)&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;Second, it helps you &lt;strong&gt;&lt;em&gt;learn&lt;/em&gt;&lt;/strong&gt;. Wait, I shouldn't already master the subject? Yes, but when you research deep into it you can find some &lt;strong&gt;&lt;em&gt;missing pieces&lt;/em&gt;&lt;/strong&gt; from your knowledge and also explaining a concept may develop you even more. Take the &lt;strong&gt;&lt;em&gt;learning pyramid&lt;/em&gt;&lt;/strong&gt; as the argument for this.  &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%2Fcdn.dribbble.com%2Fusers%2F246954%2Fscreenshots%2F1442129%2Fdribbbleinfographic.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%2Fcdn.dribbble.com%2Fusers%2F246954%2Fscreenshots%2F1442129%2Fdribbbleinfographic.png" alt="Learning pyramid"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, an appreciated skill at most jobs is the capacity to &lt;strong&gt;&lt;em&gt;mentor&lt;/em&gt;&lt;/strong&gt; others and &lt;strong&gt;&lt;em&gt;transfer knowledge&lt;/em&gt;&lt;/strong&gt;. In this way, you develop this ability and build a &lt;strong&gt;&lt;em&gt;“portfolio”&lt;/em&gt;&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;This introduction is already too long, so let’s start with my past weeks journey.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh4.googleusercontent.com%2FmknZOxQ5N3aRfIunc9Q1uTp41Ob0QbPOmj1WVng6V_DbxO0pl20d5x6SZU2s_pGy7h4wpke5Chnd4ByCTMslSbyOZo5EWpa6bMWp72RBKxIXsdN6Uiijn92dSvqpBAoXlSMsOeJH" 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%2Flh4.googleusercontent.com%2FmknZOxQ5N3aRfIunc9Q1uTp41Ob0QbPOmj1WVng6V_DbxO0pl20d5x6SZU2s_pGy7h4wpke5Chnd4ByCTMslSbyOZo5EWpa6bMWp72RBKxIXsdN6Uiijn92dSvqpBAoXlSMsOeJH"&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Find a topic
&lt;/h3&gt;

&lt;p&gt;My first dilemma was: &lt;strong&gt;what should I write about?&lt;/strong&gt; I know that I am excited about &lt;strong&gt;web development&lt;/strong&gt; and that it is my area o strength, but what people would like to find out from me? What content would bring value to them?&lt;/p&gt;

&lt;p&gt;The process was the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Brainstorming&lt;/strong&gt; in a document. Anything from keywords, technologies, subjects, etc.. I was trying to start the brain rolls.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;My next stop was Google, especially &lt;strong&gt;Google Trends&lt;/strong&gt;. I wanted to discover what people want to find out about &lt;em&gt;web development, JavaScript, ReactJS&lt;/em&gt; and others. I couldn’t say that it gave me the answer, but I noticed a large interest in &lt;strong&gt;general topics&lt;/strong&gt; related to JavaScript &lt;em&gt;(duh, of course)&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After that, I was thinking a lot about that complicated &lt;em&gt;JavaScript interview questions&lt;/em&gt; that always have a little &lt;strong&gt;trick&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the end, I decided to combine the previous thought with my desire to help others &lt;strong&gt;understand&lt;/strong&gt; those concepts, not just to recall the answer.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Therefore I decided that the topic will be about &lt;strong&gt;strange things&lt;/strong&gt; that happen in JavaScript, &lt;strong&gt;explained&lt;/strong&gt; with examples. Also, the article should be &lt;strong&gt;informal&lt;/strong&gt;, &lt;strong&gt;friendly&lt;/strong&gt; and &lt;strong&gt;funny&lt;/strong&gt;. &lt;em&gt;(I hope I got that part)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The title
&lt;/h3&gt;

&lt;p&gt;I know what you are thinking. Why choose a title before the content was written? It’s not a little bit &lt;strong&gt;superficial&lt;/strong&gt;? Yes and no, I would say.&lt;/p&gt;

&lt;p&gt;Picking your title may help you clarify the &lt;strong&gt;big picture&lt;/strong&gt; of the article, the general approach that you will apply.&lt;/p&gt;

&lt;p&gt;Let me give you an example. My first article could have taken many forms, with similar content. It could be just a &lt;strong&gt;fun article&lt;/strong&gt; where I expose the WTFs without any explanations, or maybe I could have chosen &lt;strong&gt;interview questions&lt;/strong&gt; instead of WTFs, less fun, more productive. You got the point.&lt;/p&gt;

&lt;p&gt;Now, let’s dissect the title of the article, &lt;em&gt;“6 JavaScript WTFs and what to learn from them”&lt;/em&gt;. My objective was to &lt;strong&gt;summarize&lt;/strong&gt; the content and to add some &lt;strong&gt;small clickbait crumbs&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The content was described by &lt;strong&gt;“Javascript, WTFs and learn”&lt;/strong&gt; and the clickbait is formated only by that &lt;strong&gt;“6”,&lt;/strong&gt; which helps to provide something specific and also because brains are attracted to numbers. &lt;em&gt;(“JavaScript WTFs and what to learn from them” doesn’t sound that good, right?)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I will recommend the following article if you want to go deeper into this subject: &lt;a href="https://dev.to/gsto/choose-your-next-article-topic-with-this-exercise-17m2"&gt;Choose your next article topic with this exercise&lt;/a&gt; by &lt;a href="https://dev.to/gsto"&gt;Glenn Stovall&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Build a structure
&lt;/h3&gt;

&lt;p&gt;My simple construction started with the principal chunks of the article: &lt;strong&gt;Introduction, Content, and Conclusion&lt;/strong&gt;. For each of them, I started to add &lt;strong&gt;small bullet points&lt;/strong&gt; with the main ideas.&lt;/p&gt;

&lt;p&gt;For example, for the conclusion, I wanted to speak about the &lt;strong&gt;habit&lt;/strong&gt; of checking the official documentation when facing a problem, that those WTFs are funny, but &lt;strong&gt;may hide bugs&lt;/strong&gt; and that this is my &lt;strong&gt;first attempt&lt;/strong&gt; in writing a technical article.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start developing each point
&lt;/h3&gt;

&lt;p&gt;After the structure was ready the focus was to &lt;strong&gt;implement&lt;/strong&gt; each small idea and &lt;strong&gt;research&lt;/strong&gt; for the WTFs.&lt;/p&gt;

&lt;p&gt;I tried to read enough to make sure I &lt;strong&gt;fully understand&lt;/strong&gt; the subject and therefore be able to expose it in a &lt;strong&gt;simplified manner&lt;/strong&gt;. After each WTF I asked myself the following questions: &lt;em&gt;The content it’s clear enough? It explains the subject correctly?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Also, for each of them, my idea was to add as many &lt;strong&gt;code examples&lt;/strong&gt; as possible to &lt;em&gt;visualize&lt;/em&gt; the explanations.&lt;/p&gt;

&lt;p&gt;In the end, I thought of some &lt;strong&gt;funny images&lt;/strong&gt; that are suitable for that case, with the idea of making the article more friendly. &lt;em&gt;(but not overuse them)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Markup or text
&lt;/h3&gt;

&lt;p&gt;My approach was to write the content &lt;strong&gt;directly as markup&lt;/strong&gt;. I didn’t have significant experience with it, so I googled for an online markup tool and my choice was &lt;strong&gt;&lt;a href="https://stackedit.io/app" rel="noopener noreferrer"&gt;StackEdit&lt;/a&gt;&lt;/strong&gt;. It had a simple interface, with everything I needed.&lt;/p&gt;

&lt;p&gt;For this article, I have written the content as text and I will transform it into markup, at the end. Until now I can say that the &lt;strong&gt;writing process was quicker&lt;/strong&gt;, but I should see how much time I will invest in transforming it.&lt;/p&gt;

&lt;p&gt;Let me know in the comment what method works best for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prepare for publish
&lt;/h3&gt;

&lt;p&gt;Besides good content and great ability to present information, the &lt;strong&gt;“promotion”&lt;/strong&gt; and the general aspect of the article is essential.&lt;/p&gt;

&lt;p&gt;First, I created a &lt;strong&gt;cover image&lt;/strong&gt;, using Photoshop, that has the scope to &lt;strong&gt;steal your attention&lt;/strong&gt; for just a fraction. If you aren’t familiar with Photoshop, you can use other free online tools like &lt;strong&gt;&lt;a href="http://canva.com" rel="noopener noreferrer"&gt;Canva&lt;/a&gt;&lt;/strong&gt; to create it. I followed the &lt;strong&gt;&lt;a href="https://dev.to/p/editor_guide"&gt;editor guide&lt;/a&gt;&lt;/strong&gt; advice and made it &lt;em&gt;1000px x 420px&lt;/em&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%2Flh6.googleusercontent.com%2FZHxzBt27PzD9BPmMadItwAjpExpYpLpV1F7rHlE_oaVDW5c7fYucUXQHJkOCm1f5dhw46nB4SAtxiaFg3E-ThqYZ7lqoGaIgSz1yoedyrguVeGa6rxYGIDRCe7OCQ--fAfUk6Abv" 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%2Flh6.googleusercontent.com%2FZHxzBt27PzD9BPmMadItwAjpExpYpLpV1F7rHlE_oaVDW5c7fYucUXQHJkOCm1f5dhw46nB4SAtxiaFg3E-ThqYZ7lqoGaIgSz1yoedyrguVeGa6rxYGIDRCe7OCQ--fAfUk6Abv" alt="Cover image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Research for the &lt;strong&gt;best time and day&lt;/strong&gt; to post your article. As it was my first article, I also took this aspect into consideration and I found &lt;strong&gt;&lt;a href="https://dev.to/daolf/-what-is-the-best-time-to-post-on-devto-a-data-backed-answer--1kob"&gt;this&lt;/a&gt;&lt;/strong&gt; article that presents &lt;em&gt;(based on data)&lt;/em&gt; what could be the best option. I combined it with the fact that the majority of dev.to members are from the USA and I picked &lt;strong&gt;Monday 14:00 (Bucharest time)&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Review
&lt;/h3&gt;

&lt;p&gt;Review it’s also valuable, therefore, I &lt;em&gt;read the whole article a couple of times&lt;/em&gt;, used &lt;strong&gt;&lt;a href="https://app.grammarly.com" rel="noopener noreferrer"&gt;Grammarly&lt;/a&gt;&lt;/strong&gt; to correct some typos or mistakes and also ask other persons to give me some feedback.&lt;/p&gt;

&lt;p&gt;Further, I wrote a &lt;strong&gt;short description&lt;/strong&gt; for the social media platforms and I was ready to publish.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh5.googleusercontent.com%2FSvy1BqFQD-mKvOqx5uGOGgTlA7iB8S-M8MxYG0hU77UyVdPOtqmGnwX9kH93wC825dV6Pv4zLY-tK-6_J6baDvigmrLwOckucV9AA66GdHy1zeUrKPRMtxy0Asb5XNdAOrgMMQ7T" 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%2Flh5.googleusercontent.com%2FSvy1BqFQD-mKvOqx5uGOGgTlA7iB8S-M8MxYG0hU77UyVdPOtqmGnwX9kH93wC825dV6Pv4zLY-tK-6_J6baDvigmrLwOckucV9AA66GdHy1zeUrKPRMtxy0Asb5XNdAOrgMMQ7T" alt="Publish banner"&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Social Media
&lt;/h3&gt;

&lt;p&gt;My first step in the social media strategy was to identify the &lt;strong&gt;platforms&lt;/strong&gt; where my &lt;strong&gt;public&lt;/strong&gt; should be and try to grab their &lt;strong&gt;attention&lt;/strong&gt; &lt;em&gt;(and 5-8 minutes of their lives)&lt;/em&gt;. I know that not everyone is a social media person but I think that, in this case, you should see it as the &lt;em&gt;process that helps you get in touch with your public&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The platforms that I used are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dev.to&lt;/strong&gt; as the publishing platform. This platform was a recommendation and I found it perfect for the first steps. It's &lt;strong&gt;free&lt;/strong&gt;, &lt;strong&gt;popular&lt;/strong&gt; and &lt;strong&gt;made for developers&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LinkedIn&lt;/strong&gt;, where a have a &lt;strong&gt;2000&lt;/strong&gt; contacts network. I consider LinkedIn a place where I can find my audience, people that are oriented on &lt;strong&gt;learning&lt;/strong&gt; and &lt;strong&gt;development&lt;/strong&gt; and also start building my portfolio.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Twitter&lt;/strong&gt;, where I opened the account only for this article, as it is not so popular in Romania.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reddit&lt;/strong&gt;, one of the largest platforms out there. Hard to believe, but I didn’t have an account on Reddit either &lt;em&gt;(you can judge me for that)&lt;/em&gt;, but I knew that it’s a large audience here and I gave it a try.&lt;/p&gt;

&lt;p&gt;Why not &lt;strong&gt;Facebook&lt;/strong&gt; or &lt;strong&gt;Instagram&lt;/strong&gt;? In my case I thought that &lt;strong&gt;my target&lt;/strong&gt; is not on those two platforms. &lt;em&gt;(at least for the moment)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Numbers, numbers, numbers
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh3.googleusercontent.com%2F6AbZC10pb_w0sj3U_PrX6PH1VAXYKaDYa18ZSnuVRF5agKhW1UnPntGATth_IoqVdV4SgZaLAsNEjcS-nbk9g1Sy0YGyjRmf3e04DeXKLefcIgySApDiRGVjL4UrXpVE_WOVEUZL" 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%2Flh3.googleusercontent.com%2F6AbZC10pb_w0sj3U_PrX6PH1VAXYKaDYa18ZSnuVRF5agKhW1UnPntGATth_IoqVdV4SgZaLAsNEjcS-nbk9g1Sy0YGyjRmf3e04DeXKLefcIgySApDiRGVjL4UrXpVE_WOVEUZL" alt="Social media insights"&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dev.to&lt;/strong&gt;: The main activity of the article took place here. It exceeded my expectations for my first article &lt;em&gt;(it was a blind shoot)&lt;/em&gt; and I was glad to see &lt;strong&gt;interest&lt;/strong&gt; in my content and style of writing. The &lt;strong&gt;number of followers&lt;/strong&gt; also amazed me, we will talk about it in a moment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LinkedIn&lt;/strong&gt;: I was more relaxed with this environment because my presence there started 5 years ago. The activity &lt;strong&gt;started slow&lt;/strong&gt;, but in the end, it was nice seeing people that appreciated the content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Twitter&lt;/strong&gt;: I &lt;em&gt;didn’t invest so much effort&lt;/em&gt; in this one. I just shared the article on my 0 followers account and hope for the best.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reddit&lt;/strong&gt;: I &lt;strong&gt;failed&lt;/strong&gt; miserably. My first and second posts were &lt;strong&gt;removed&lt;/strong&gt; and my third one, on another JS group, didn’t get any upvote&lt;/p&gt;

&lt;h3&gt;
  
  
  Reactions progress
&lt;/h3&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%2Flh4.googleusercontent.com%2FNVHXJ2JWtvA2EURREW-NWgKpYCCdf-Fn_YVbhuzJ58dBcYjh4sZZSDAqSKBRbiRq1WMGZtJOIMo_w9JNDuvvS-Eg-GjJRr3kxTi1ZgKPI-SC4-yk2hCqIjm-d3ZMz-LcUdbXAOZh" 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%2Flh4.googleusercontent.com%2FNVHXJ2JWtvA2EURREW-NWgKpYCCdf-Fn_YVbhuzJ58dBcYjh4sZZSDAqSKBRbiRq1WMGZtJOIMo_w9JNDuvvS-Eg-GjJRr3kxTi1ZgKPI-SC4-yk2hCqIjm-d3ZMz-LcUdbXAOZh" alt="reactions progress"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another interesting aspect was the things that I felt after hitting the publish button. In the first two hours, I tasted some &lt;strong&gt;agitation&lt;/strong&gt; and &lt;strong&gt;concern&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The article only got &lt;strong&gt;5-8 reactions&lt;/strong&gt; &lt;em&gt;(deep down inside I knew that those were my friends)&lt;/em&gt;, and the LinkedIn post &lt;strong&gt;3-4 likes&lt;/strong&gt;. That was the moment that I said, ok, this is not for me, I &lt;strong&gt;failed&lt;/strong&gt;, I should focus on other matters.&lt;/p&gt;

&lt;p&gt;Around &lt;strong&gt;18:20&lt;/strong&gt; I left work, I got on my electric scooter and “drive” for 10 minutes. After that, I check dev.to and something wonderful happened. Almost &lt;strong&gt;40 reactions&lt;/strong&gt;, all the numbers went up and I received some &lt;strong&gt;positive comments&lt;/strong&gt;. It’s hard to explain that feeling, but it was &lt;strong&gt;lit&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%2Fi.pinimg.com%2Foriginals%2Fb0%2F6c%2F7a%2Fb06c7a0e9a95238134ae2e6c7bbf5ea2.jpg" 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%2Fi.pinimg.com%2Foriginals%2Fb0%2F6c%2F7a%2Fb06c7a0e9a95238134ae2e6c7bbf5ea2.jpg" alt="Litt meme"&gt;&lt;/a&gt;&lt;br&gt;
For 2 hours I have other activity scheduled &lt;em&gt;(where I didn’t check my phone)&lt;/em&gt; and after that, the reactions reached almost &lt;strong&gt;60&lt;/strong&gt;, the views went up, another motivation dose.&lt;/p&gt;

&lt;p&gt;At that moment I just wanted to take my laptop and &lt;strong&gt;dig for my next topic&lt;/strong&gt;. After that, it went up until the morning.&lt;/p&gt;

&lt;p&gt;The life span of the article activity was pretty much &lt;strong&gt;24h&lt;/strong&gt;. &lt;em&gt;(yes, short life)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Moral of the story, have the &lt;strong&gt;patience&lt;/strong&gt; for your content and take as much &lt;strong&gt;fresh feedback&lt;/strong&gt; as you can.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The Time Zone Bucharest, Romania (UTC/GMT +3 hours in the summer)&lt;/p&gt;

&lt;h3&gt;
  
  
  Followers
&lt;/h3&gt;

&lt;p&gt;An aspect that I didn’t take into consideration was the &lt;strong&gt;followers&lt;/strong&gt; from the dev.to platform. As the article got traction, the number of followers started to raise and hitting almost &lt;strong&gt;700&lt;/strong&gt; in two weeks. &lt;em&gt;(thank you all)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Looking at the numbers I realized that there are people in the community that consider my content &lt;strong&gt;useful&lt;/strong&gt; and &lt;strong&gt;valuable&lt;/strong&gt;. That gave me the motivation to continue this path with a lot of energy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Comments
&lt;/h3&gt;

&lt;p&gt;The comments from LinkedIn are all positive, &lt;strong&gt;two&lt;/strong&gt; of them from known people and &lt;strong&gt;two&lt;/strong&gt; from persons that I never talk with.&lt;/p&gt;

&lt;p&gt;On the dev.to platform, there were &lt;strong&gt;three&lt;/strong&gt; positive comments, one &lt;strong&gt;neutral&lt;/strong&gt; &lt;em&gt;(I can’t decode the feeling from it)&lt;/em&gt; and &lt;strong&gt;one&lt;/strong&gt; constructive/negative. &lt;em&gt;(that person pointed me to a part of the article that was debatable)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I responded to all of them &lt;em&gt;(didn't take me long)&lt;/em&gt; and I took them as great energizers.&lt;/p&gt;

&lt;p&gt;P.S.: Here is the funniest notification for &lt;strong&gt;views achievement&lt;/strong&gt; I have ever seen.&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%2Flh3.googleusercontent.com%2F8UA9QR84tzuCs-gQvEZbtZ3Exlx7qzUPRCa96bidz0dBZ4NefBAP7RplQp8qukROdzNcxGy7TFbDwb8Jq9dUVHyzWmd0CHEid2mK9W3c64inh7aSMTb8PFYKcWdB3vtif8lBqYq9" 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%2Flh3.googleusercontent.com%2F8UA9QR84tzuCs-gQvEZbtZ3Exlx7qzUPRCa96bidz0dBZ4NefBAP7RplQp8qukROdzNcxGy7TFbDwb8Jq9dUVHyzWmd0CHEid2mK9W3c64inh7aSMTb8PFYKcWdB3vtif8lBqYq9" alt="views notification"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh4.googleusercontent.com%2FCf8ng25b8ICA0XXH7jTHbjDA-R3L5BmCv7X2J48tjDMsEsbgz9fv2fNGOUxO8KoIaUEo8KKn8yHZQP75r0oXO-UjjrYpGu-I3mpSblV5xTDYAoHGSWcD-wTujJmQgPIffmf_ro1P" 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%2Flh4.googleusercontent.com%2FCf8ng25b8ICA0XXH7jTHbjDA-R3L5BmCv7X2J48tjDMsEsbgz9fv2fNGOUxO8KoIaUEo8KKn8yHZQP75r0oXO-UjjrYpGu-I3mpSblV5xTDYAoHGSWcD-wTujJmQgPIffmf_ro1P" alt="Conclusion banner"&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My objectives for this article are to &lt;strong&gt;share my story&lt;/strong&gt; and &lt;strong&gt;help others&lt;/strong&gt; start creating content. The advice that I received a couple of weeks ago was, of course, &lt;strong&gt;“just start”&lt;/strong&gt;. Deeply inside you know that is true but sometimes it's hard to &lt;em&gt;“just do it”&lt;/em&gt;. With this article, I want to add a &lt;strong&gt;small brick to people's trust wall&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After you manage to start, focus yourself on &lt;strong&gt;delivering quality content&lt;/strong&gt;. Again, &lt;strong&gt;research&lt;/strong&gt; your subject and existing content in order to get a strong context, then bring &lt;strong&gt;something new&lt;/strong&gt;, always with &lt;strong&gt;your target audience&lt;/strong&gt; in mind.&lt;/p&gt;

&lt;p&gt;Maybe the previous points may seem that they don’t have the best fit, but it’s not the case. You can &lt;strong&gt;force your brain to start&lt;/strong&gt; doing the task you are thinking about and &lt;strong&gt;focus&lt;/strong&gt; afterward on giving your best.&lt;/p&gt;

&lt;p&gt;Don’t try to make it more than perfect. Even &lt;a href="https://dev.to/ben"&gt;Ben Halpern&lt;/a&gt; says that &lt;strong&gt;85%&lt;/strong&gt; perfect is better than &lt;strong&gt;100%&lt;/strong&gt; perfect. &lt;em&gt;(check his &lt;a href="https://dev.to/ben/some-of-my-writing-principles-k4e"&gt;article&lt;/a&gt; on writing principles)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading it through the final, I hope it was helpful and you got &lt;strong&gt;1% more motivated&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Happy writing!📰&lt;/p&gt;

</description>
      <category>writing</category>
      <category>productivity</category>
      <category>career</category>
      <category>motivation</category>
    </item>
    <item>
      <title> 6 JavaScript WTFs and what to learn from them</title>
      <dc:creator>Andrei Bumbu</dc:creator>
      <pubDate>Mon, 29 Jul 2019 10:55:24 +0000</pubDate>
      <link>https://dev.to/andreib123/6-javascript-wtfs-and-what-to-learn-from-them-406d</link>
      <guid>https://dev.to/andreib123/6-javascript-wtfs-and-what-to-learn-from-them-406d</guid>
      <description>&lt;p&gt;Hi! I'm sure that in your JavaScript developer journey you saw at least once &lt;em&gt;(per day)&lt;/em&gt;  &lt;strong&gt;‘undefined’ is not a function&lt;/strong&gt; or you asked yourself why &lt;strong&gt;the type of the NaN is actually a number.&lt;/strong&gt; Well, sometimes JavaScript wants to put you to the pressure test.&lt;br&gt;
    &lt;a href="https://i.giphy.com/media/l41Yb2wVzu9vmumZi/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l41Yb2wVzu9vmumZi/giphy.gif" alt="Gordon Ramsay angry"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article, you will be part of an adventure in the funny &lt;em&gt;(and dark)&lt;/em&gt; side of this beautiful programming language. Let's start!&lt;/p&gt;


&lt;h2&gt;
  
  
  1. Min &amp;gt; Max
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&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;
  
  
  Explanation:
&lt;/h2&gt;

&lt;p&gt;Ok, so first let's define a couple of things.&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Math&lt;/code&gt;&lt;/strong&gt; is a built-in object that has properties and methods for mathematical constants and functions. Not a function object.&lt;/li&gt;
&lt;li&gt;The static function &lt;strong&gt;&lt;code&gt;Math.max()&lt;/code&gt;&lt;/strong&gt; returns the largest-valued number passed into it, or &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN" rel="noopener noreferrer"&gt;&lt;code&gt;NaN&lt;/code&gt;&lt;/a&gt; if any parameter isn't a number and can't be converted into one.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Perfect, until now we know what the Math object represents in JavaScript and what the &lt;strong&gt;.max()&lt;/strong&gt; static function does. Similarly, the &lt;strong&gt;.min()&lt;/strong&gt; function will do the opposite operation. Until now our instinct may say that &lt;em&gt;Math.max()&lt;/em&gt; should return the &lt;strong&gt;Number.MAX_VALUE&lt;/strong&gt; if no parameters are provided.&lt;/p&gt;

&lt;p&gt;However, that assumption would be erroneous. Here's why. Imagine that you will have to implement a function that finds the &lt;strong&gt;maximum value from an array&lt;/strong&gt;. That's easy! The simplest way to do it is to iterate through the entire array, compare the elements and &lt;em&gt;store the maximum value&lt;/em&gt;. Here's the twist! That variable where you store the maximum value should be initialized with a &lt;strong&gt;very, very small value&lt;/strong&gt;, the smallest.&lt;/p&gt;

&lt;p&gt;You might think by now that, ok, the smallest value in Javascript is &lt;strong&gt;Number.MIN_VALUE (5e-324)&lt;/strong&gt; and you are right. But, JavaScript has something prepared for you in this particular case and that is &lt;strong&gt;Infinity&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The global &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity" rel="noopener noreferrer"&gt;&lt;code&gt;Infinity&lt;/code&gt;&lt;/a&gt; property is a numeric value representing infinity.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And finally, full description of &lt;em&gt;.max()&lt;/em&gt; function:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Math.max() returns the largest of the given numbers. If any one or more of the parameters cannot be converted into a number, &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN" rel="noopener noreferrer"&gt;&lt;code&gt;NaN&lt;/code&gt;&lt;/a&gt; is returned. The result is &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity" rel="noopener noreferrer"&gt;&lt;code&gt;-Infinity&lt;/code&gt;&lt;/a&gt; if no parameters are provided.&lt;/p&gt;


&lt;/blockquote&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;Infinity&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="kc"&gt;Infinity&lt;/span&gt; &lt;span class="c1"&gt;//true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Takeaways:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What is &lt;strong&gt;Math&lt;/strong&gt; object&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;min()&lt;/strong&gt; and &lt;strong&gt;max()&lt;/strong&gt; functions behave&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infinity&lt;/strong&gt; object in JavaScript&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  2. 0.1 + 0.2 = ?
&lt;/h2&gt;

&lt;p&gt;Well, that's too easy. 0.1 + 0.2 = 0.3, right? Not in JavaScript! &lt;em&gt;(or JAVA, or C++, or C#, or..you got the point)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt; &lt;span class="c1"&gt;//false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fmedia0.giphy.com%2Fmedia%2F3o7btPCcdNniyf0ArS%2Fgiphy.gif" 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%2Fmedia0.giphy.com%2Fmedia%2F3o7btPCcdNniyf0ArS%2Fgiphy.gif" alt="Intense calculations"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explanation:
&lt;/h2&gt;

&lt;p&gt;How is this possible? Before you reconsider all the basic math that you learned, let me introduce &lt;a href="http://0.30000000000000004.com/" rel="noopener noreferrer"&gt;Floating Point Math&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Computers can only natively store &lt;strong&gt;integers&lt;/strong&gt;, so they need some way of representing decimal numbers. This representation comes with some degree of &lt;strong&gt;inaccuracy&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This subject's a complex one and needs some serious number of hours invested in it. However, I will try to simplify it for this particular situation.&lt;/p&gt;

&lt;p&gt;In the case of &lt;strong&gt;base 10 system&lt;/strong&gt;, the only fractions that can be expressed cleanly are the ones with prime factor as a base &lt;em&gt;(½, ¼, 1⁄5, etc.)&lt;/em&gt;. In comparison 1⁄3 has &lt;strong&gt;repeating decimals&lt;/strong&gt; &lt;em&gt;(0,33333..)&lt;/em&gt;. Now if we take this information and apply it for &lt;strong&gt;2 base system&lt;/strong&gt;, the clean fractions are &lt;em&gt;½, ¼ and 1⁄8&lt;/em&gt;, while &lt;em&gt;1⁄5 and 1⁄10&lt;/em&gt; have repeating decimals. That's causing some leftovers in this example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mf"&gt;0.30000000000000004&lt;/span&gt; &lt;span class="c1"&gt;//true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;When you do the math on these repeating decimals, you end up with &lt;strong&gt;leftovers&lt;/strong&gt; which carry over when you convert the computer's base 2 (binary) number into a more human-readable base 10 number.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Takeaways:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Floating Point Math&lt;/strong&gt; overview&lt;/li&gt;
&lt;li&gt;This concept applies to &lt;em&gt;most of the programming languages&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. baNaNa
&lt;/h2&gt;

&lt;p&gt;Good, after that hard mathematical problem, let's do something fun!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;baNaNa&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Explanation:
&lt;/h2&gt;

&lt;p&gt;Different from the other 2 WTFs, this one is a little bit simpler. That's because you have 75% of the problem solved. Now we have just one tiny aspect to clarify: what &lt;strong&gt;+ +"a"&lt;/strong&gt; will return.&lt;/p&gt;

&lt;p&gt;JavaScript syntax is valid because the second &lt;strong&gt;+&lt;/strong&gt; is not the addition operator, but a &lt;strong&gt;unary operator&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;strong&gt;&lt;a href="https://www.ecma-international.org/ecma-262/#sec-unary-plus-operator" rel="noopener noreferrer"&gt;unary +&lt;/a&gt;&lt;/strong&gt; operator converts its operand to Number type. Any unsupported values will be evaluated to &lt;code&gt;NaN&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That was effortless! So our expression will l as below, because &lt;strong&gt;"a"&lt;/strong&gt; can't be converted to a Number.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="kc"&gt;NaN&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;baNaNa&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In order to conclude we should confirm one more piece of the puzzle. What &lt;strong&gt;String + String + NaN + String&lt;/strong&gt; will return? How the addition operator will behave?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;strong&gt;&lt;a href="https://www.ecma-international.org/ecma-262/#sec-addition-operator-plus" rel="noopener noreferrer"&gt;addition operator&lt;/a&gt;&lt;/strong&gt; either performs string concatenation or numeric addition.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, there are two types of addition that can occur, &lt;strong&gt;string concatenation&lt;/strong&gt; or &lt;strong&gt;numeric addition&lt;/strong&gt;, in this particular order. The way the algorithm work is the following: &lt;/p&gt;

&lt;p&gt;Transform the operands into primitives using &lt;strong&gt;&lt;a href="https://www.ecma-international.org/ecma-262/#sec-toprimitive" rel="noopener noreferrer"&gt;ToPrimitive()&lt;/a&gt;&lt;/strong&gt; function. &lt;/p&gt;

&lt;p&gt;If one of the operands is a &lt;strong&gt;String&lt;/strong&gt;, then transform the other one into a String and perform &lt;em&gt;string concatenation&lt;/em&gt;. Otherwise, convert both of them to &lt;strong&gt;Number&lt;/strong&gt; and execute &lt;em&gt;numeric addition&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ba&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ba&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="kc"&gt;NaN&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ba&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NaN&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;baNaN&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;baNaN&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;baNaNa&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Takeaways:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What is &lt;strong&gt;Unary operator&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Addition operator &lt;em&gt;algorithm&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ToPrimitive()&lt;/strong&gt; function and one use case for it&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Initialization before the declaration?
&lt;/h2&gt;

&lt;p&gt;Take this code for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;don't forget to hit the heart button if you liked it.&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;promoteArticle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Stranger&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;promoteArticle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;var&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What will be prompted in the console? A &lt;strong&gt;ReferenceError&lt;/strong&gt; that message is not defined? Or maybe the string &lt;strong&gt;"Stranger, undefined"&lt;/strong&gt;. No, it must be a &lt;strong&gt;TypeError&lt;/strong&gt;, promoteArticle is not a function.&lt;/p&gt;

&lt;p&gt;Fortunately for us, the output will be exactly what we wanted: &lt;em&gt;"Stranger, don't forget to hit the heart button if you linked it"&lt;/em&gt;. But why? The &lt;strong&gt;"Hoisting"&lt;/strong&gt; &lt;em&gt;(buzzword)&lt;/em&gt; JavaScript behavior is responsible for that.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hoisting is JavaScript's default behavior of &lt;code&gt;moving declarations to the top&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Note: This is available only for variables defined with the var keyword and declared functions.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Using this piece of information we can claim that our code will look like this after &lt;strong&gt;compilation&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;promoteArticle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;var&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;don't forget to hit the heart button if you liked it.&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;promoteArticle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Stranger&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;p&gt;Let's take it step by step. The &lt;strong&gt;promoteArticle() function&lt;/strong&gt; is on the top because function declarations are the &lt;strong&gt;first&lt;/strong&gt; elements moved to the top, followed by var variable declaration.&lt;/p&gt;

&lt;p&gt;Also, no error is thrown and the message has the right value is because by the time the function is invoked, the variable was both &lt;strong&gt;declared&lt;/strong&gt; and &lt;strong&gt;initialized&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Just to make sure I didn't cause any kind of confusion, I will mention the difference between &lt;strong&gt;declared functions and expression functions&lt;/strong&gt;.  Below is an example containing both types.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;declaredPromoteArticle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;var&lt;/span&gt; &lt;span class="nx"&gt;expressionPromoteArticle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;And after compile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;declaredPromoteArticle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;var&lt;/span&gt; &lt;span class="nx"&gt;expressionPromoteArticle&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// just the variable definition was hoisted&lt;/span&gt;
&lt;span class="nx"&gt;expressionPromoteArticle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;h3&gt;
  
  
  Takeaways:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What is &lt;strong&gt;Hoisting&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Function declaration vs function expression&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. typeof NaN == 'number'
&lt;/h2&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%2Ftilldawngroup.com%2Fwp-content%2Fuploads%2F2015%2F04%2Fgiphy-1.gif" 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%2Ftilldawngroup.com%2Fwp-content%2Fuploads%2F2015%2F04%2Fgiphy-1.gif" alt="God please no meme"&gt;&lt;/a&gt;&lt;br&gt;
This one might appear strange especially because of the lexical side, &lt;strong&gt;"Not a number is a number"&lt;/strong&gt;, but it will make sense in a second. First, let's inspect the definition:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;strong&gt;global&lt;/strong&gt; &lt;code&gt;NaN&lt;/code&gt; property is a value representing Not-A-Number.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A simple and clear definition for NaN, but we can find the trick in the &lt;strong&gt;'global'&lt;/strong&gt; word. Contrary to our first instinct, NaN is not a keyword (like null, if, var, etc.), but a &lt;strong&gt;global property&lt;/strong&gt;. What global object may include this property? Yes, you guessed it, is the &lt;strong&gt;Number object&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="kc"&gt;NaN&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;number&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kc"&gt;NaN&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;number&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;//true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE" rel="noopener noreferrer"&gt;&lt;code&gt;Number.MIN_VALUE&lt;/code&gt;&lt;/a&gt;&lt;br&gt;
The smallest positive representable number - that is, the positive number closest to zero (without actually being zero).&lt;br&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NaN" rel="noopener noreferrer"&gt;&lt;code&gt;Number.NaN&lt;/code&gt;&lt;/a&gt;&lt;br&gt;
Special "not a number" value.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Why I also extracted the MIN_VALUE property you may ask. It's because it will be clearer why the JavaScript compiler doesn't know any difference between &lt;strong&gt;MIN_VALUE&lt;/strong&gt; and &lt;strong&gt;NaN&lt;/strong&gt; property, and therefore both types are &lt;strong&gt;numbers&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Takeaways:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;NaN it's not a keyword, but a property&lt;/li&gt;
&lt;li&gt;How &lt;a href="https://www.ecma-international.org/ecma-262/#sec-typeof-operator" rel="noopener noreferrer"&gt;type of&lt;/a&gt; operator behaves in this case&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Array.prototype.sort()
&lt;/h2&gt;

&lt;p&gt;The subject of the last WTF is the behavior of the &lt;strong&gt;sort()&lt;/strong&gt; method, without any parameter sent.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;32&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;6&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;//[3, 32, 6]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok, that not work how we expected. Why the values are in that particular order? Let's take &lt;strong&gt;more examples&lt;/strong&gt; and be adventurous.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;32&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="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;//[3, 32, 6, true]&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;32&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="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;NaN&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;//[3, 32, 6, NaN, true]&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;32&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="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;NaN&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="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;//[3, 32, 6, NaN, true, undefined]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Got it? Yup, the default algorithm &lt;strong&gt;casts&lt;/strong&gt; each value into a &lt;em&gt;string&lt;/em&gt; and then sort them accordingly. &lt;/p&gt;

&lt;p&gt;In order to reach the expected result, sort() method will need &lt;strong&gt;a compare function&lt;/strong&gt; as a parameter. That function receives &lt;strong&gt;two parameters&lt;/strong&gt; and return a number which describes the &lt;em&gt;relation between them&lt;/em&gt;. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The notation a &amp;lt; b means comparefn(a,  b) &amp;lt; 0; a = b means comparefn(a,  b) = 0 (of either sign); and a  &amp;gt;  b means comparefn(a,  b) &amp;gt; 0.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Below it's an example using an array of users. The sort algorithm is based on the  &lt;strong&gt;age property&lt;/strong&gt; of each user.&lt;br&gt;
&lt;/p&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;users&lt;/span&gt; &lt;span class="o"&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;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Andrei&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Denisa&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;
    &lt;span class="p"&gt;}];&lt;/span&gt;
&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;first&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;second&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;first&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;second&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//[ { name: 'Denisa', age: 23 }, { name: 'Andrei', age: 24 } ]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Takeaways:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Array.prototype.sort()&lt;/strong&gt; default behavior&lt;/li&gt;
&lt;li&gt;How to implement a &lt;strong&gt;specific&lt;/strong&gt; sort mechanism&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bonus: &lt;code&gt;NaN&lt;/code&gt;  is not a  &lt;code&gt;NaN&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Surprise, there is more!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kc"&gt;NaN&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;NaN&lt;/span&gt; &lt;span class="c1"&gt;//false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This one refers to the &lt;a href="https://www.ecma-international.org/ecma-262/#sec-strict-equality-comparison" rel="noopener noreferrer"&gt;Strict Equality Comparison&lt;/a&gt; and its implementation.&lt;/p&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt; If  &lt;a href="https://www.ecma-international.org/ecma-262/#sec-ecmascript-data-types-and-values" rel="noopener noreferrer"&gt;Type&lt;/a&gt;(x) is different from  &lt;a href="https://www.ecma-international.org/ecma-262/#sec-ecmascript-data-types-and-values" rel="noopener noreferrer"&gt;Type&lt;/a&gt;(y), return  false. &lt;/li&gt;
&lt;li&gt; If  &lt;a href="https://www.ecma-international.org/ecma-262/#sec-ecmascript-data-types-and-values" rel="noopener noreferrer"&gt;Type&lt;/a&gt;(x) is Number, then

&lt;ol&gt;
&lt;li&gt; If  x  is  &lt;code&gt;NaN&lt;/code&gt;, return  false.&lt;/li&gt;
&lt;li&gt; If  y  is  &lt;code&gt;NaN&lt;/code&gt;, return  false.
...&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt; Return  &lt;a href="https://www.ecma-international.org/ecma-262/#sec-samevaluenonnumber" rel="noopener noreferrer"&gt;SameValueNonNumber&lt;/a&gt;(x,  y).&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;As we know, the NaN type is number so the &lt;em&gt;second if the condition is matched&lt;/em&gt;. After that, if any of the operands is NaN, &lt;strong&gt;false&lt;/strong&gt; is returned.&lt;/p&gt;

&lt;h3&gt;
  
  
  Takeaways:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The first part of &lt;strong&gt;Strict Equality Comparison&lt;/strong&gt; implementation&lt;/li&gt;
&lt;li&gt;Last part of that algorithm uses another one named &lt;strong&gt;SameValueNonNumber&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Finally, we are done. You might think that those WTFs are &lt;strong&gt;childish&lt;/strong&gt; &lt;em&gt;(and you will be right from some of them)&lt;/em&gt;, but they may hide &lt;strong&gt;small bugs&lt;/strong&gt; &lt;em&gt;(with big impact)&lt;/em&gt; and waste a lot of your time and energy.&lt;/p&gt;

&lt;p&gt;Also, the &lt;strong&gt;habit&lt;/strong&gt; to search in the official documentation when something seems fishy in your code and learn &lt;em&gt;how the compiler "thinks"&lt;/em&gt; can really improve your skills.&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%2Fmedia0.giphy.com%2Fmedia%2F8JW82ndaYfmNoYAekM%2Fgiphy.gif" 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%2Fmedia0.giphy.com%2Fmedia%2F8JW82ndaYfmNoYAekM%2Fgiphy.gif" alt="Done meme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;This is my first attempt in writing technical articles. Please let me any kind of feedback in the comments and also what topics are you interested in. Happy coding!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>beginners</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
