<?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>Forem: Vikram Sahu </title>
    <description>The latest articles on Forem by Vikram Sahu  (@sahuvikramp).</description>
    <link>https://forem.com/sahuvikramp</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%2F143064%2F6387111f-5f44-4f6a-9cbe-548c6ead78c6.jpg</url>
      <title>Forem: Vikram Sahu </title>
      <link>https://forem.com/sahuvikramp</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sahuvikramp"/>
    <language>en</language>
    <item>
      <title>What Is Cryptography? And How to Encrypt Data in Postman</title>
      <dc:creator>Vikram Sahu </dc:creator>
      <pubDate>Tue, 08 Mar 2022 21:54:59 +0000</pubDate>
      <link>https://forem.com/postman/what-is-cryptography-and-how-to-encrypt-data-in-postman-238l</link>
      <guid>https://forem.com/postman/what-is-cryptography-and-how-to-encrypt-data-in-postman-238l</guid>
      <description>&lt;p&gt;With APIs responsible for sending or receiving any sort of information over the internet—from a simple phone call to your bank transactions—today’s increase in internet usage and data sharing means APIs must be aligned with &lt;a href="https://blog.postman.com/tag/security/"&gt;security&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When APIs exchange data over an insecure network, there is a greater chance of that data getting manipulated by a malicious third party. So to make the internet safer and to avoid unnecessary data theft, it is always better to encrypt every piece of information before pushing it to a network.&lt;/p&gt;

&lt;p&gt;This is where the concept of cryptography comes in. Cryptography is one of the ways we can keep information secured over an insecure public network. Let’s dive deeper into cryptography, how it works, and how to use crypto encryption with the &lt;a href="https://www.postman.com/product/what-is-postman/"&gt;Postman API Platform&lt;/a&gt;.&lt;/p&gt;

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

&lt;p&gt;In simple terms, “cryptography” refers to the art of securing sensitive information using mathematical algorithms. These algorithms stop third parties, commonly known as adversaries or hackers, to peep into your data. To avoid unauthorized access to information communicated between authorized parties, cryptography uses encryption and decryption methods. According to American cryptographer and computer security expert Bruce Schneier, cryptography is “the art and science of keeping messages secure.”The cryptography method transforms plain text into encrypted text (aka ciphertext) using the encryption key, and the target receiver can decrypt it using a unique decryption key. This decryption key depends on what type of cryptography algorithm is used by the sender. It’s important to note that encryption algorithms keep the data secure only if the attackers are unaware of your method of encryption or anything else about the key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vSSNu1kH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.postman.com/wp-content/uploads/2022/03/cryptography-2-1000x415.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vSSNu1kH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.postman.com/wp-content/uploads/2022/03/cryptography-2-1000x415.png" alt="Example cryptography workflow" width="880" height="365"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Example cryptography workflow&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3 types of cryptography
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://en.wikipedia.org/wiki/Cryptographic_hash_function"&gt;Hash function&lt;/a&gt;:&lt;/strong&gt; Hash functions are the most commonly used cryptography algorithms, in which there is no involvement of any key. In hash functions, plain text is transformed into a fixed-length of value, which is never recovered to its original form.

&lt;ul&gt;
&lt;li&gt;The best use of hash functions is password comparison without storing them. The plain text will output the same hash every time whenever a particular function is called.&lt;/li&gt;
&lt;li&gt;Hash functions include &lt;a href="https://en.wikipedia.org/wiki/MD5"&gt;MD5&lt;/a&gt;, &lt;a href="https://en.wikipedia.org/wiki/SHA-2"&gt;SHA256&lt;/a&gt;, &lt;a href="https://en.wikipedia.org/wiki/RIPEMD"&gt;RIPEMD160&lt;/a&gt;, and more.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://en.wikipedia.org/wiki/Symmetric-key_algorithm"&gt;Symmetric key encryption&lt;/a&gt;:&lt;/strong&gt; In symmetric cryptography, both sender and receiver share a single key, which they use to encrypt and decrypt. This system is faster and simpler as compared to other encryption types. The only limitation is sharing the key with the recipient over an insecure network. Symmetric encryption is brilliant when data is stored and accessed centrally.

&lt;ul&gt;
&lt;li&gt;For example, the password manager encrypts the passwords, which are not sent to anyone and stored on the machine and you’ll only need one key because you are the only one using it.&lt;/li&gt;
&lt;li&gt;Common symmetric encryption algorithms include &lt;a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard"&gt;AES&lt;/a&gt; and &lt;a href="https://en.wikipedia.org/wiki/Data_Encryption_Standard"&gt;DES&lt;/a&gt;, which we will cover in the later part of this blog post.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://en.wikipedia.org/wiki/Public-key_cryptography"&gt;Asymmetric key encryption&lt;/a&gt;:&lt;/strong&gt; Asymmetric cryptography uses different keys for encryption and decryption of information. It uses a public key for encryption, but also a private key for decryption of data.

&lt;ul&gt;
&lt;li&gt;Common asymmetric encryption algorithms include &lt;a href="https://en.wikipedia.org/wiki/Elliptic-curve_cryptography"&gt;ECC&lt;/a&gt; and &lt;a href="https://en.wikipedia.org/wiki/RSA_(cryptosystem)"&gt;RSA&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h2&gt;
  
  
  How to encrypt data in Postman?
&lt;/h2&gt;

&lt;p&gt;Postman allows you to perform different tasks on API requests and test scripts where you might apply encryption—for comparing within the test or authenticating headers—and there are many other possibilities when encryption can be used. To help users work with different options, Postman supports a list of&lt;a href="https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#using-external-libraries"&gt;external libraries&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Crypto.js is one of the most requested libraries for encryption and decryption. You can find a list of examples in &lt;a href="https://www.postman.com/postman/workspace/postman-answers/collection/18070393-66f7caac-3005-44b2-8620-16dfb64a35f4?ctx=documentation"&gt;this crypto.js&lt;/a&gt;collection, which you can start working with by forking to your workspace:&lt;/p&gt;

&lt;h3&gt;
  
  
  Postman Collections for cryptography algorithms
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.postman.com/postman/workspace/postman-answers/request/18070393-0d062245-65cd-4595-aa29-7d52e0591d16"&gt;AES (Advanced Encryption Standard):&lt;/a&gt; AES is symmetric cryptography that uses a &lt;a href="https://en.wikipedia.org/wiki/Block_cipher"&gt;block cipher&lt;/a&gt;. It is used in both software and hardware across the world for encrypting sensitive data. AES uses three block ciphers, which include 128-bits, 192-bites, and 256-bits which are used to encrypt and decrypt data. Code sample for AES encryption:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Message **=** pm.variables.replaceIn('{{$randomCatchPhrase}}')

const SecretPassphrase **=** pm.variables.replaceIn('{{$randomPassword}}')

var superSecretEncrypted **=** CryptoJS.AES.encrypt(Message, SecretPassphrase);
var noMoreSuperSecret **=** CryptoJS.AES.decrypt(superSecretEncrypted,

console. **log** ("superSecretEncrypted :: " **+** superSecretEncrypted **+**"\n" **+** 
"superSecretDecrypted :: " **+** noMoreSuperSecret);SecretPassphrase);

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.postman.com/postman/workspace/postman-answers/request/18070393-890c5450-a224-490e-a686-bd804744b255"&gt;DES (Data Encryption Standard)&lt;/a&gt;: DES is also symmetric cryptography, which uses the same key to encrypt and decrypt data. It is considered less secure for powerful attacks, due to which the popularity among others has slightly declined. DES encrypts data in 64-bits, which means that 64-bits plain text input is sent and 64-bits ciphertext output is produced. Similarly, &lt;a href="https://www.postman.com/postman/workspace/postman-answers/request/18070393-4bec87f8-eea0-4a4a-af34-38f1b07c6a9d"&gt;Triple DES&lt;/a&gt; can also be used, where the  DES encryption is applied three times to each block to increase the key size. Code sample for DES encryption:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Message **=** pm.variables.replaceIn('{{$randomCatchPhrase}}')
const SecretPassphrase **=** pm.variables.replaceIn('{{$randomPassword}}')

var superSecretEncrypted **=** CryptoJS.DES.encrypt(Message, SecretPassphrase);
var noMoreSuperSecret **=** CryptoJS.DES.decrypt(superSecretEncrypted, SecretPassphrase);

console. **log** ("superSecretEncrypted :: " **+** superSecretEncrypted **+**"\n" **+** 
"superSecretDecrypted :: " **+** noMoreSuperSecret);

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.postman.com/postman/workspace/postman-answers/request/18070393-d1fd1172-daef-44d2-a993-5591d1f5d9e7"&gt;MD5 (Message-Digest Algorithm)&lt;/a&gt;: MD5 is a protocol used for authorizing messages, content, and digital signature verification. It generates a hash that can be used to verification of data or files by sender and receiver. Previously, MD5 was majorly used for encryption of data, but now it’s primarily used for authentication. The algorithm converts data into a string of 32 characters, irrespective of file size. Code sample for MD5 hash:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Message **=** pm.variables.replaceIn('{{$randomCatchPhrase}}')
//setting up collection variable as MD5hash
var MD5hash **=** CryptoJS.MD5(Message). **toString** ();
console. **log** ("MD5hash :: " **+** MD5hash)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.postman.com/postman/workspace/postman-answers/request/18070393-a911b1c6-8766-4e3e-bf82-8ec2946b13a2"&gt;SHA-256 (Secure Hashing Algorithm)&lt;/a&gt;: SHA-256 is a patented algorithm that is a part of the SHA-2 family. This is a hash function that produces 256-bits long ciphertext. It was a successor for SHA-1 which was losing strength against brute force attacks. Code sample for SHA-256:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var sha256Hash **=**   CryptoJS.SHA256(Message). **toString** ();
console. **log** ("sha256Hash :: " **+** sha256Hash)
const Message **=** pm.variables.replaceIn('{{$randomCatchPhrase}}')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;After walking through the cryptography algorithms above, we can see that cryptography is an essential tool for encryption that makes data secure and safe. Ultimately, data stored or transmitted with encryption is much safer than data left unencrypted. There are a lot more cryptography algorithms that can be used for different purposes depending on the use cases, so be sure to explore the complete &lt;a href="https://www.postman.com/postman/workspace/postman-answers/collection/18070393-66f7caac-3005-44b2-8620-16dfb64a35f4"&gt;Encrypt Parameters Using CryptoJS collection&lt;/a&gt; to learn more.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.postman.com/what-is-cryptography-how-to-encrypt-data-in-postman/"&gt;What Is Cryptography? And How to Encrypt Data in Postman&lt;/a&gt; appeared first on &lt;a href="https://blog.postman.com"&gt;Postman Blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>api</category>
      <category>security</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>3 Popular Collaboration Features for Postman Collections</title>
      <dc:creator>Vikram Sahu </dc:creator>
      <pubDate>Mon, 14 Feb 2022 18:33:27 +0000</pubDate>
      <link>https://forem.com/postman/3-popular-collaboration-features-for-postman-collections-3g6g</link>
      <guid>https://forem.com/postman/3-popular-collaboration-features-for-postman-collections-3g6g</guid>
      <description>&lt;p&gt;We all know that &lt;a href="https://learning.postman.com/docs/getting-started/creating-the-first-collection/" rel="noopener noreferrer"&gt;Postman Collections&lt;/a&gt; are one of the most important pillars of the &lt;a href="https://www.postman.com/product/what-is-postman/" rel="noopener noreferrer"&gt;Postman API Platform&lt;/a&gt;. They allow you to organize, manage, and document your APIs efficiently, and they act as a central storage where you can save your API requests.&lt;/p&gt;

&lt;p&gt;But there are many features attached to a collection that make using Postman user-friendly—and a few of the most popular ones are the move, duplicate, and share features. You can find these functions by hovering over a collection name and clicking the three dots as shown in the screenshot below:&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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fcollections-move-duplicate-share-blog-post-1-573x1024.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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fcollections-move-duplicate-share-blog-post-1-573x1024.png" alt="Options for collection activity"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Options for collection activity&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let’s have a look at these three foundational features in detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Move
&lt;/h2&gt;

&lt;p&gt;The move feature allows you to transfer a collection from one workspace to another. This feature helps you collaborate effectively, especially while working with your team.&lt;/p&gt;

&lt;p&gt;Let’s assume you’ve made some changes to the collection on your personal workspace, and now you want to hand over the collection to another member of your team. It becomes super simple to transfer the collection using this functionality.&lt;/p&gt;

&lt;p&gt;When moving a collection, there are a few prerequisites:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://learning.postman.com/docs/collaborating-in-postman/roles-and-permissions/#collection-roles" rel="noopener noreferrer"&gt;Roles and permissions&lt;/a&gt;: To use the move feature without any restriction, you need to have editor access for the collection.&lt;/li&gt;
&lt;li&gt;A collection cannot be moved from the team, private, or &lt;a href="https://blog.postman.com/introducing-postman-public-workspaces/" rel="noopener noreferrer"&gt;public workspaces&lt;/a&gt; to personal workspaces.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How to move a collection in Postman
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Hover over the collection name, click the three dots ( &lt;strong&gt;°°°&lt;/strong&gt; ) beside the star icon.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Move&lt;/strong&gt; from the list.&lt;/li&gt;
&lt;li&gt;Find and select the workspace using the search bar, then click on &lt;strong&gt;Move Collection&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Check and confirm the target workspace.&lt;/li&gt;
&lt;/ol&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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fimage2.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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fimage2.gif" alt="Moving a collection"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Moving a collection&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Duplicate
&lt;/h2&gt;

&lt;p&gt;The Duplicate feature is similar to cloning a repository on &lt;a href="https://blog.postman.com/better-practices-for-git-version-control-in-postman/" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. This feature can be used to create a copy of the current version of the collection which is kept untouched, and another can be used to work parallely on your new API features.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to duplicate a collection in Postman
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Hover over the collection name, click the three dots ( &lt;strong&gt;°°°&lt;/strong&gt; ) beside the star icon.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Duplicate&lt;/strong&gt; from the list.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once you click &lt;strong&gt;Duplicate&lt;/strong&gt; , you can find a new collection with the collection name format of “collection name Copy.” (For example, if the initial collection is ABC &lt;strong&gt;,&lt;/strong&gt; then the copy would be ABC Copy and if duplicating recursively, then the resulting collections would be named ABC Copy 2, ABC Copy 3 &lt;strong&gt;,&lt;/strong&gt; and so on.)&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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fduplicate.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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fduplicate.gif" alt="Duplicating a collection"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Duplicating a collection&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;Collaboration is a vital part of every team, especially when the team is small and everyone is working on similar priorities. Sharing helps users to collaborate conveniently. You can share a collection via the link or by moving it to a shared private, team, or public workspace.&lt;/p&gt;

&lt;p&gt;Workspaces can be shared via the Run in Postman button or JSON link, but we need to make sure that the visibility of the workspace is public.&lt;/p&gt;

&lt;p&gt;To  share the workspace with people, here are a few prerequisites:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You need to have admin access for the workspace from which you will be using the share functionality, or else you will only be able to share with members who are already in the workspace.&lt;/li&gt;
&lt;li&gt;If the collection is in a personal workspace, then you need to change the workspace visibility to the team.&lt;/li&gt;
&lt;li&gt;If you have Editor access, you’ll have the ability to give new collaborators Viewer or Editor access to the collection.&lt;/li&gt;
&lt;li&gt;If you have Viewer access, you’ll be able to share, but you won’t be able to assign roles.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sharing features allow you to share in three different ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sharing with people:&lt;/li&gt;
&lt;/ol&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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fjson-share-link-1000x652.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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fjson-share-link-1000x652.png" alt="Sharing a collection via invite using name, email, or group name"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Sharing a collection via invite using name, email, or group name&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;a href="https://learning.postman.com/docs/publishing-your-api/run-in-postman/creating-run-button/" rel="noopener noreferrer"&gt;Run in Postman&lt;/a&gt; button:&lt;/li&gt;
&lt;/ol&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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Frun-in-postman-share-1000x811.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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Frun-in-postman-share-1000x811.png" alt="Sharing a collection via the Run in Postman button"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Sharing a collection via the Run in Postman button&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JSON link: A public, shareable link to a static copy of your collection:&lt;/li&gt;
&lt;/ol&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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fshare-1000x407.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%2Fblog.postman.com%2Fwp-content%2Fuploads%2F2022%2F02%2Fshare-1000x407.png" alt="Sharing collection via JSON link"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Sharing collection via JSON link&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  For collections—and much more
&lt;/h2&gt;

&lt;p&gt;These are a few easy ways you can start collaborating in Postman. Also, just like with a Postman Collection, you can use the above features with other elements in Postman—including APIs, environments, mocks, and monitors.&lt;/p&gt;



&lt;p&gt;The post &lt;a href="https://dev.to/jansche/3-popular-collaboration-features-for-postman-collections-39lk-temp-slug-1213605"&gt;3 Popular Collaboration Features for Postman Collections&lt;/a&gt; appeared first on &lt;a href="https://blog.postman.com" rel="noopener noreferrer"&gt;Postman Blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>api</category>
      <category>productivity</category>
    </item>
    <item>
      <title>WebSockets: A Conceptual Overview</title>
      <dc:creator>Vikram Sahu </dc:creator>
      <pubDate>Wed, 18 Aug 2021 03:24:30 +0000</pubDate>
      <link>https://forem.com/sahuvikramp/websockets-a-conceptual-overview-41m</link>
      <guid>https://forem.com/sahuvikramp/websockets-a-conceptual-overview-41m</guid>
      <description>&lt;p&gt;&lt;em&gt;Note: This article is for technical folks ranging from beginner to intermediate level. so if you are already aware of a particular topic, please feel free to check the Table of Content&lt;/em&gt; ⏩&lt;/p&gt;

&lt;h2&gt;
  
  
  ✔ Introduction &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Real-time communication has taken a great pace in shaping the world of the internet. In the post COVID era, every type of communication has changed, right from sending emails and waiting for your client's response to interacting with them on Slack communities.&lt;/p&gt;

&lt;p&gt;This instant messaging, video/audio calls, and other similar technologies have gradually helped us to improve with time management and reduced the overall response time.&lt;/p&gt;

&lt;p&gt;These innovations have become possible just because of &lt;strong&gt;WebSockets&lt;/strong&gt; 🔌.&lt;/p&gt;

&lt;p&gt;In this article, we will go through some amazing concepts of WebSockets and how APIs are implemented for fluent real-time communication.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✔ Table of Content &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is a WebSocket?&lt;/li&gt;
&lt;li&gt;Why WebSocket?&lt;/li&gt;
&lt;li&gt;Lifecycle of a WebSocket&lt;/li&gt;
&lt;li&gt;WebSockets Protocol Overview.&lt;/li&gt;
&lt;li&gt;WebSocket APIs&lt;/li&gt;
&lt;li&gt;Advantages of WebSockets&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Reference&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✔ What is a WebSocket? &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;WebSocket is a &lt;a href="https://en.wikipedia.org/wiki/Transport_layer" rel="noopener noreferrer"&gt;transport layer&lt;/a&gt; protocol that provides a persistent connection between client and server. This WebSocket operates over a TCP/IP socket connection and provides a full-duplex and bidirectional functionality for the communication.&lt;/p&gt;

&lt;p&gt;E.g., Let's assume we want to create a wired connection where two-person want to communicate with each other (ie. A wants to talk with B). Now, to start the conversation it becomes mandatory for one end(A) to have a dial-in number (acts as handshake) for connecting to the other end(B).&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.imgur.com%2Fow0Pc4J.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.imgur.com%2Fow0Pc4J.jpg" alt="communication"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, once (assuming) &lt;strong&gt;A&lt;/strong&gt; has successfully dialed to &lt;strong&gt;B&lt;/strong&gt;, then a persistent connection will be established between A and B just like a tunnel where the information can flow from both ends.&lt;/p&gt;

&lt;p&gt;Messaging applications work the same as the wired connection we discussed above where a connection is created and the sequence of messages is exchanged with great speed.&lt;/p&gt;

&lt;p&gt;But wait... ⏳&lt;/p&gt;

&lt;p&gt;Can't these messages be sent using REST APIs? Why do developers prefer switching to WebSockets? Is there some issue with REST APIs?&lt;/p&gt;

&lt;p&gt;Well, no worries! Let's dig up more and understand why WebSocket was introduced when there were REST APIs?&lt;/p&gt;

&lt;p&gt;⬆Back to Top&lt;/p&gt;

&lt;h2&gt;
  
  
  ✔ Why WebSocket? &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The API is an HTTP-based technology that allows two applications to communicate with each other. This HTTP-based technology strictly operates over unidirectional protocol. Here, the server makes sure that every response data sent has to be requested from the client.&lt;/p&gt;

&lt;p&gt;Now, let's get back to our messaging application where two people chat using APIs. Since HTTP APIs are unidirectional the client and server have to act both respectively and make continuous to and fro connections to get response data (relay messages from A to B and vice versa). These connections are tedious to handle.  &lt;/p&gt;

&lt;p&gt;To avoid this messy connection, there comes a concept of long polling. This long polling acts as a workaround for the above scenario where a client can send an HTTP request with a long timeout period and the server can keep pushing data back to the client.&lt;/p&gt;

&lt;p&gt;Since this is just a workaround, you can expect some drawbacks as well, i.e. long polling works perfectly when the client and server are having continuous data transfer, but the problem arises when there is no data available to send back to the client. The server unnecessarily holds the resources throughout the length of the poll (timeout).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To overcome the above limitation of HTTP-based Technology, *WebSockets was born&lt;/strong&gt;*.&lt;/p&gt;

&lt;p&gt;The resources are unnecessarily tied up to the server throughout the length of the poll in HTTP., On the other hand, WebSocket allows communicating over the network freely. This communication is quite similar to &lt;a href="https://en.wikipedia.org/wiki/User_Datagram_Protocol" rel="noopener noreferrer"&gt;UDP&lt;/a&gt; but with the security of &lt;a href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol" rel="noopener noreferrer"&gt;TCP&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;⬆Back to Top&lt;/p&gt;

&lt;h2&gt;
  
  
  ✔ Lifecycle of a WebSocket  &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;WebSocket follows &lt;a href="https://datatracker.ietf.org/doc/html/rfc6455" rel="noopener noreferrer"&gt;RFC 6455 - protocol&lt;/a&gt; where it asks for an opening handshake followed by a basic message framing, layered over TCP.&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.imgur.com%2FfPu6V75.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%2Fi.imgur.com%2FfPu6V75.png" alt="webSocket cycle"&gt;&lt;/a&gt;&lt;br&gt;
                Image credits: &lt;a href="https://www.raywenderlich.com/13209594-an-introduction-to-websockets" rel="noopener noreferrer"&gt;raywenderlich&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;WebSockets begin their life cycle by initiating a standard HTTP request and response as shown in the image above. Within this request, the client asks servers to open a web connection. If the server agrees, then an initial handshake is established successfully.&lt;/p&gt;

&lt;p&gt;This handshake is a piece of evidence that the client and server have agreed to share the TCP/IP socket for communication as a WebSocket connection. Now the information can flow using basic message framing protocol. To close the socket both ends should acknowledge for turning down the TCP connection.&lt;/p&gt;

&lt;p&gt;I hope by this time you might have understood why WebSockets are used instead of REST APIs.&lt;/p&gt;

&lt;p&gt;⬆Back to Top&lt;/p&gt;

&lt;h2&gt;
  
  
  ✔ WebSockets Protocol Overview &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;WebSockets URIs are the same as HTTP URIs but the only difference you can find is the scheme. WebSockets don't use an HTTP/HTTPS scheme; instead it uses ws/wss (web socket secure) to connect with the hosts/endpoints. E.g.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP URIs&lt;/strong&gt;: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

http://domain-name[:port]/resource-path/resource-id
&lt;span class="o"&gt;{&lt;/span&gt;secured&lt;span class="o"&gt;}&lt;/span&gt; https://domain-name[:port]/resource-path/resource-id


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;WebSocket URIs&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

ws://domain-name[:port]/resource-path/resource-id
&lt;span class="o"&gt;{&lt;/span&gt;secured&lt;span class="o"&gt;}&lt;/span&gt; wss://domain-name[:port]/resource-path/resource-id


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

&lt;/div&gt;

&lt;p&gt;To establish a secure WebSocket connection, the HTTP request/response calls need to be upgraded. So, the clients/server both need to support the WebSocket connection and pass a few request headers.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

GET ws://localhost2.com:3000/ HTTP/1.1
Host: localhost:8000
Connection: Upgrade
Pragma: no-cache
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: &lt;span class="nv"&gt;q3xPeO32u5496gldTuKaSAh&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Let us understand each header that is required to establish a WebSocket connection.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;GET ws://localhost2.com:3000/ HTTP/1.1&lt;/code&gt;: This is an actual GET call that connects a WebSocket insecurely &lt;code&gt;{ws}&lt;/code&gt; having endpoint as &lt;code&gt;localhost2.com:3000&lt;/code&gt; using the first version of the HTTP protocol.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Host: localhost:8000&lt;/code&gt;: This is a Host from where the request is initiated. Currently, it is a local machine &lt;code&gt;localhost:8000&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Connection: Upgrade&lt;/code&gt;: Connection header manages the opening and closing of network connection after the HTTP call. It is normally set to &lt;code&gt;keep-alive&lt;/code&gt; which helps to keep the connection persistent while HTTP calls. Using &lt;code&gt;Upgrade&lt;/code&gt; makes sure to keep the connection active and notifies that communication will open for non-HTTP requests only.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Pragma: no-cache&lt;/code&gt;: It is a means for the browser to tell the server and any intermediate caches that it wants a fresh version of the resource, not for the server to tell the browser not to cache the resource&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Upgrade: websocket&lt;/code&gt;: The header is used by the client to ask the server to follow one of the protocols for connection. In this case, the client is asking for a WebSocket connection.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Sec-WebSocket-Version: 13&lt;/code&gt;: The WebSocket protocol only accepts the usage of version 13, any other version will be considered invalid here.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Sec-WebSocket-Key: q3xPeO32u5496gldTuKaSAh==&lt;/code&gt;: This is one time randomly generated unique key which is 16-byte and base64 encoded.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once the client has securely established a WebSocket connection, it waits for the server's response which has &lt;code&gt;HTTP 101 Switching Protocols&lt;/code&gt;. The server's response headers are shown below.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: &lt;span class="nv"&gt;aGVsbG8gZXZlcnlvbmUg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The HTTP 101 Switching Protocols response indicates that the server is switching to the protocol that the client requested in its Upgrade request header. In addition, the server must include HTTP headers that validate the connection was successfully upgraded.&lt;/p&gt;

&lt;p&gt;⬆Back to Top&lt;/p&gt;

&lt;h2&gt;
  
  
  ✔ WebSocket APIs &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;WebSocket API allows creating a bidirectional, full-duplex persistent connection that helps two applications to interact with each other fluently.&lt;/p&gt;

&lt;p&gt;This can be visualized as a tunnel where data can be sent and received constantly without waiting for each other's response.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✔ Advantages of WebSockets &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bidirectional&lt;/strong&gt;: In HTTP, the client needs to wait for the server's response after every request, whereas on the other side WebSockets allows the client/server to send and receive real-time updates asynchronously. E.g. stocks dashboard where data is continuously pushed and the graph is plotted against the same.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Low-Latency&lt;/strong&gt;: WebSockets doesn't create a new connection for every request therefore the network latency is automatically reduced. After the initial handshake, which includes standard HTTP header information, all subsequent messages include only relevant information. This reduction in latency enables lightning-fast communication&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extensible&lt;/strong&gt;: The WebSocket API supports over&lt;br&gt;
40 subprotocols such as WAMP, XMPP, AMQP, and MQTT, as well as extensions that enable powerful functionality like&lt;br&gt;
multiplexing and data compression.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Secure&lt;/strong&gt;: The WebSocket Secure (WSS) protocol uses standard SSL and TLS encryption to establish a secure connection&lt;br&gt;
between the client and server. While unsecured WebSockets use TLS port number 80, WSS uses port 443.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⬆Back to Top&lt;/p&gt;

&lt;h2&gt;
  
  
  ✔ Conclusion &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;In this article, we began with the introduction of WebSockets and learned how WebSockets are used behind the scenes while building Real-time applications to make our life faster and simpler. &lt;/p&gt;

&lt;p&gt;Next, we went through some technical concepts of the WebSocket protocol. Also, we compare how WebSockets are different from HTTP-based technology with some real-life examples.&lt;/p&gt;

&lt;p&gt;As we end this article, you should have a clear understanding of WebSockets and how they can be used in your future applications.&lt;/p&gt;

&lt;p&gt;Please leave your feedback and doubts in the comments below! 😃&lt;/p&gt;

&lt;h2&gt;
  
  
  ✔ Reference &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://datatracker.ietf.org/doc/html/rfc6455" rel="noopener noreferrer"&gt;https://datatracker.ietf.org/doc/html/rfc6455&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Websockets_API#interfaces" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Websockets_API#interfaces&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.bitsrc.io/apis-vs-websockets-vs-webhooks-what-to-choose-5942b73aeb9b" rel="noopener noreferrer"&gt;https://blog.bitsrc.io/apis-vs-websockets-vs-webhooks-what-to-choose-5942b73aeb9b&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.raywenderlich.com/13209594-an-introduction-to-websockets" rel="noopener noreferrer"&gt;https://www.raywenderlich.com/13209594-an-introduction-to-websockets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ably.com/topic/websockets" rel="noopener noreferrer"&gt;https://ably.com/topic/websockets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>api</category>
      <category>websockets</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Explaining Bots and Its types - Part 1</title>
      <dc:creator>Vikram Sahu </dc:creator>
      <pubDate>Tue, 07 Apr 2020 16:59:46 +0000</pubDate>
      <link>https://forem.com/pepipost/explaining-bots-and-its-types-part-1-15po</link>
      <guid>https://forem.com/pepipost/explaining-bots-and-its-types-part-1-15po</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Fact&lt;/b&gt;: Do you know that a normal person interacts at least 3-4 times a day with a bot? but when? and how? impressive isn't it...&lt;br&gt;
It is also said that in the future a person will interact more with a bot than their spouse.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's unfold the truth behind this...&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt; Introduction &lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;In simple words, bots are dumb machines that are programmed to do repetitive tasks, which are automated by a human being to save time. This was the definition that I concluded after working on a few bots. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E5VhGR2w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eu5qnbj3326gpaalps6y.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E5VhGR2w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eu5qnbj3326gpaalps6y.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bots are coming into existence more and more because of their accuracy, speed and much more similar behavior to humans. if you ask me where I can find a bot? I would reply in just a few words "&lt;b&gt;Everywhere on the web&lt;/b&gt;".&lt;/p&gt;

&lt;p&gt;The most common bot/type of bot that you can experience right now is&lt;br&gt;
Just unlock your phone and speak:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Hey, Siri" if you have iPhone.&lt;/li&gt;
&lt;li&gt;"Ok, Google" if you have Android. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Similarly, you can find Alexa or Google Home/mini which are also home assistants used for many tasks that a human wants to execute within the house like playing music, asking for news or setting reminders and many more.&lt;/p&gt;

&lt;p&gt;The above examples are advance bots that were contributed by Gaint technology leaders, but there are many small bots that developers write for their own convenience, it can be chatbots, a web crawler, social bots, and some malicious bots.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt; Good Bot vs Bad Bot&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;This is the section, let's dive deep with nature of bots and how they are helpful to us with our day to day task.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H5xNmxRR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q79ha4tew9gntk4jjvkn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H5xNmxRR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q79ha4tew9gntk4jjvkn.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, Bots are developed to automate various repetitive tasks which turns out to be useful in many ways, but few are developed to harm your resource which is classified into good bots and bad bots.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;What is a Good Bot?&lt;/b&gt; 

&lt;ul&gt;
&lt;li&gt;Good bots are built to gain profit for the business. These bots are beneficial for both businesses and individuals. The simple example you can assume is whenever you search for any websites, products or any services, you often get next to accurate results, how?&lt;/li&gt;
&lt;li&gt;This is possible because of search engines spider bot which is also known as &lt;b&gt;crawler bot&lt;/b&gt;. Bots like 

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://support.google.com/webmasters/answer/182072?hl=en"&gt;Googlebot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Slurp Bot [yahoo]&lt;/li&gt;
&lt;li&gt;Alexa crawler [Amazon Alexa]&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Reputed companies often deploy this bot by following the rules of the webmaster crawling activity and indexing rate at websites &lt;a href="https://www.techinasia.com/talk/robotstxt-secure-website-content"&gt;robot.txt&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Besides from these search engine crawlers, there are many different third party bots like

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://api.slack.com/bot-users"&gt;Slack bot.&lt;/a&gt; (Any complex integration can be done which can be notified directly on the channel).&lt;/li&gt;
&lt;li&gt;&lt;a href="https://core.telegram.org/bots"&gt;telegram bot.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Pingdom bot. (website monitoring bot)&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;By this time you might be clear about good bots, so any bot who follow the rules and regulation of webmaster and the policies which result in profit for business are good bots.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;b&gt; What is a Bad Bot?&lt;/b&gt;

&lt;ul&gt;
&lt;li&gt;As we know Bad is always opposite to Good. These bots are built by hackers, cybercriminals, fraudsters so that they get engaged in illegal activities.&lt;/li&gt;
&lt;li&gt;These bots are programmed for doing malicious jobs on the web.&lt;/li&gt;
&lt;li&gt;Let's take an example, you have a business setup for toys and you have a unique toy that is made by you. your competitor may build a bot that can be a scraper that can collect all the content, product reviews, feedbacks and what new toy you are working on and publish fake reviews on other websites.&lt;/li&gt;
&lt;li&gt;The second example is they travel thousands of visits on your website within the minimum span of time, that chokes the availability for other genuine users. &lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;This bot is highly injurious for brand reputation which results in hampering of search engine website ranking.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt; Types of Bots&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;b&gt;Good Bots&lt;/b&gt; are used to gain profit for the business and also helps to build your domain and website health. This bot helps by crawling website for search engine optimization(SEO), Collecting information, obtaining marketing analytics and many more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6YOLuQG3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qe87o9zpcwz13agl8uq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6YOLuQG3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qe87o9zpcwz13agl8uq8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;b&gt;Social Network Bots&lt;/b&gt;: These bots are managed and supported by social networking sites like &lt;a href="https://developers.facebook.com/docs/workplace/integrations/custom-integrations/bots/"&gt;Facebook&lt;/a&gt;, Twitter. Bots help to give visibility to the brand website and drive engagement to their platforms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;b&gt;Feedfetcher Bots&lt;/b&gt;: These bots are used to collect information from different websites and help to keep subscribers updated with the product, events, and blog posts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;b&gt;Parter Bots&lt;/b&gt;: These bots are third party bots that are developed and supported by the SaaS organization like Slack, PayPal, Stripe and many more. these bots help to integrate directly with the program within the organization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;b&gt;Monitoring Bots&lt;/b&gt;: These bots are programmed in such a way that they periodically monitor and updates us about the uptime and health of the server/websites.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;b&gt;Search Engine Crawlers&lt;/b&gt;: These are the most common and maybe most used bots in this modern world. No matter, who you are you need search engines for simplicity and get your work done.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's look at few &lt;b&gt;Bad Bots&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LQCJO2UZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ek6yj2ehspqzr98i56xx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LQCJO2UZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ek6yj2ehspqzr98i56xx.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;b&gt;Scraper Bots&lt;/b&gt;: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;These scrapers are used to steal vital information, prices, updates, and content. This will help the competitor to undermine the business strategies which will help them to target the company's revenue.&lt;/li&gt;
&lt;li&gt;Point to remember is that competitor ofter use third-party scrapers to perform this illegal act.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;b&gt;Spam Bots&lt;/b&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;These Spam Bots target community forums, lead collection forms, and comments sections.&lt;/li&gt;
&lt;li&gt;They usually target this section by adding unwanted promotional advertisements, links, and flood up the comment section by trolling users.&lt;/li&gt;
&lt;li&gt;The above activities frustrate genuine users to comment or use the forum's information. The main motive of such bots is to insert the link to phishing pages which are build to collect user critical information which included bank account, username, and passwords. &lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;b&gt;Scalper Bots&lt;/b&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;These bots target ticketing websites, they purchase 100-1000 of tickets and sell them to third party seller due to which the genuine ticket selling website lose their customers.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Each and every activity of a bot depends on the &lt;b&gt;data&lt;/b&gt; it can be a training data or real-time data. &lt;/li&gt;
&lt;li&gt;I always recommended not to expose your websites on HTTP instead always use HTTPS or use appropriate protocols to restrict such bots to crawl your website.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;Concluding...&lt;/b&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In this world of Machines and Artificial intelligence, I always want each and everyone to learn how the bot works and why you need a bot. &lt;/li&gt;
&lt;li&gt;If you are keen to learn this new world paradigm, "&lt;b&gt;First decode it&lt;/b&gt;" that is what I have discussed above in this blog.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope you enjoyed reading! Stay tuned for Part 2 where I will be building a Telegram bot from scratch. &lt;/p&gt;

&lt;p&gt;Thank You! Do follow and share 🤗&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ref: &lt;a href="https://www.shieldsquare.com/what-are-bots/"&gt;shieldsquare&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Learning ES6/JavaScript - Part 2</title>
      <dc:creator>Vikram Sahu </dc:creator>
      <pubDate>Sun, 29 Mar 2020 15:16:05 +0000</pubDate>
      <link>https://forem.com/sahuvikramp/learning-es6-javascript-part-2-4ff1</link>
      <guid>https://forem.com/sahuvikramp/learning-es6-javascript-part-2-4ff1</guid>
      <description>&lt;h3&gt;
  
  
  &lt;b&gt;Introduction: Let's revise a bit&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;An amazing curve of learning is to learn facts and then implement it. I started JavaScript with the curiosity of learning front-end technologies but now it is getting more interesting as I am moving forward with this language.&lt;/p&gt;

&lt;p&gt;I started with facts &lt;a href="https://dev.to/snipperbytes/learning-es6-javascript-part-1-1i3l"&gt;here&lt;/a&gt; and now I think its time to dive deep with the basics so that while implementation we are not left out with theoretical questions in mind.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;Topics &lt;/b&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Everything about Objects.&lt;/li&gt;
&lt;li&gt;Unique datatypes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;1. Everything about Objects&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;Objects are used almost in every programming language, it is used to store the keyed collection of various data and probably the complex entities. The data is store in a key-value structure where the key has to always string or any symbol(special type will discuss below) and value can be anything.&lt;/p&gt;

&lt;p&gt;&lt;b&gt; How to create an object? &lt;/b&gt;&lt;br&gt;
There are two ways of creating an empty object either using the object constructor or literal. &lt;/p&gt;

&lt;p&gt;I will try to explain using an example of a register which as a piece of developer information like their name, age, years of experience and a few 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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;register&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;{};&lt;/span&gt; &lt;span class="c1"&gt;//using object constructor syntax. &lt;/span&gt;
&lt;span class="c1"&gt;// OR&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;register&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;   &lt;span class="c1"&gt;// using object literals syntax.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;1.1 Adding, Accessing and deleting&lt;/b&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Key = property name.&lt;br&gt;
Value = property value.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In an object, the key and value should be separated using (:)colon while initialization. An object can be added using a (.)dot notation or []square bracket for the multiword key. Let's look at the simplest example for each of the cases.&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;register&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vikram&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="na"&gt;isAdmin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="c1"&gt;// Output: { user: 'vikram', age: 24, isAdmin: true } &lt;/span&gt;

&lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;experience&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;78&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// adding data in object&lt;/span&gt;

&lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;university education&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&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;Mumbai&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="cm"&gt;/* adding data with the multiword key
you can't access multiword key by (.), you need to access in the same way of addition. 
ie. alert(register["university education"])
*/&lt;/span&gt;

&lt;span class="k"&gt;delete&lt;/span&gt; &lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isAdmin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// deleting key&lt;/span&gt;

&lt;span class="c1"&gt;//do check the output and spot the difference.&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I think I don't need to explain the above code. It is a simple and self-explanatory right.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;1.2 Property value shorthand&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Shorthand is a way of optimizing code and removing complexities. let's learn by using an 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="c1"&gt;//before shorthand&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;myUser&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="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="k"&gt;return&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="nx"&gt;name&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="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;getUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vikram&lt;/span&gt;&lt;span class="dl"&gt;"&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="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;getUser&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see the above example becomes complex if the key name conflicts with the argument. so let's see at the shorthand version.&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="nx"&gt;myUser&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="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="k"&gt;return&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="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;getUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vikram&lt;/span&gt;&lt;span class="dl"&gt;"&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="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;getUser&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;isn't is simplified? the fact is you can use both the normal property value assignment and shorthand.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;1.3 Cloning and Merging&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Cloning is creating a copy of an object without affecting the original one. Ya!  the copying by reference can be used most of the time instead of cloning. Cloning an object is doable though it is not a built-in function. Let's look at an 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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;register&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vikram&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;age&lt;/span&gt;&lt;span class="dl"&gt;"&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;clone_register&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="c1"&gt;//copying register properties to clone_register&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;clone_register&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;clone_register&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above example is self-explanatory. There is one more way of directly getting clone of an object by using object.assign, you can find syntax in below 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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;newObjectName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dest&lt;/span&gt;&lt;span class="p"&gt;,[&lt;/span&gt;&lt;span class="nx"&gt;src1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;src2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;src3&lt;/span&gt;&lt;span class="p"&gt;....&lt;/span&gt;&lt;span class="nx"&gt;srcN&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 learn by building a user access level using the below 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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;clone_register&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;clone_register&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;register&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;permission1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;canView&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;true&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;permission2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;canRead&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;true&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;clone_register&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;permission1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;permission2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;clone_register&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="cm"&gt;/* output:
{ user: 'vikram',
  age: 23,
  experience: 78,
  'university education': 'Mumbai',
  canView: 'true',
  canRead: 'true' }
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;2. Unique datatypes &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Javascript is unique in its own way in the previous part you might have seen from interesting datatypes like maps, sets, and iterables like an array, strings, list and few more.&lt;/p&gt;

&lt;p&gt;I will mention a few more in this part like &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WeakMap and WeakSet.&lt;/li&gt;
&lt;li&gt;Destructing assignments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;2.1 WeakMap and WeakSet&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;WeakMaps&lt;/b&gt;:&lt;br&gt;
Let's learn by comparing Map and WeakMap. The very first difference is that WeakMap must have Object as Key, not usual primitive values. Since you will be using an object as a key in it all the other references will be removed automatically and memory will be released. &lt;br&gt;
I know it is confusing, OK let us assume &lt;code&gt;Vikram&lt;/code&gt; as key for Map now and &lt;code&gt;sahu&lt;/code&gt; as key for WeakMap. When we delete the keys from respective Maps then key &lt;code&gt;Vikram&lt;/code&gt; will be removed but memory allocated will not be released but in case of &lt;code&gt;sahu&lt;/code&gt; as key in WeakMap, the memory reference to the key will be automatically released.&lt;/p&gt;

&lt;p&gt;Example of WeakMap:&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;john&lt;/span&gt; &lt;span class="o"&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;Vikram&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;weakMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;WeakMap&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;weakMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Vikram&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;Vikram&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// overwrite the reference&lt;/span&gt;

&lt;span class="c1"&gt;// Vikram is removed from memory!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;WeakMap has similar methods as compared to Maps like:&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;weakMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;         &lt;span class="c1"&gt;//returns value for the key if exists&lt;/span&gt;
&lt;span class="nx"&gt;weakMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;//Adds new entry in WeakMaps&lt;/span&gt;
&lt;span class="nx"&gt;weakMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      
&lt;span class="nx"&gt;weakMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;WeakSet&lt;/b&gt;&lt;br&gt;
WeakSet is similar to WeakMap. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is analogous to Set, but you can only add objects to WeakSet and not primitives datatypes.&lt;/li&gt;
&lt;li&gt;An object exists in the set while it is reachable from somewhere else.&lt;/li&gt;
&lt;li&gt;Like Set, it supports add, has and delete, but not size, keys() and no iterations.
Let's take an example where we will add some users as visited website and later will remove the same by redeclaring as &lt;code&gt;null&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;visitedSet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;WeakSet&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;Vikram&lt;/span&gt; &lt;span class="o"&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;Vikram&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;Nikhil&lt;/span&gt; &lt;span class="o"&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;Nikhil&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;Anish&lt;/span&gt; &lt;span class="o"&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;Anish&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;visitedSet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Vikram&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Vikram visited us&lt;/span&gt;
&lt;span class="nx"&gt;visitedSet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Nikhil&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Then Nikhil&lt;/span&gt;
&lt;span class="nx"&gt;visitedSet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Vikram&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Vikram again&lt;/span&gt;

&lt;span class="c1"&gt;// visitedSet has 2 users now&lt;/span&gt;

&lt;span class="c1"&gt;// check if Vikram visited?&lt;/span&gt;
&lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;visitedSet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Vikram&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;

&lt;span class="c1"&gt;// check if Anish visited?&lt;/span&gt;
&lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;visitedSet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Anish&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;

&lt;span class="nx"&gt;Vikram&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// visitedSet will be cleaned automatically &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;b&gt;2.2 Destructuring assignments&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In Javascript, the most used datatype for storing, retrieving and manipulating data are &lt;code&gt;Object&lt;/code&gt; or &lt;code&gt;Arrays&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Sometimes, you might just need to pass a single value at a particular index instead of passing the whole object or Array to the function for computing right? here's were destructing assignments comes into the picture.&lt;/p&gt;

&lt;p&gt;It is simply assigning the Array to a single variable. Let's make it clear using an 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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;myData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Ed&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Eed&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Eddy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tom And jerry&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;pyscho&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;pyschoFriend&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;pyschoFriend2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;EveryOneFvrt&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;myData&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;EveryOneFvrt&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//tom And jerry&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Isn't it simple? yes, I know it quite easy. Destructing assignments doesn't mean destructive instead it means &lt;u&gt;&lt;b&gt;destructurizes&lt;/b&gt;&lt;/u&gt; has it assigns the array/object element to variables.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;Concluding...&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;I hope you have enjoyed the above blog. I will be back again with some basics but tricky fun Javascript like &lt;strong&gt;proto&lt;/strong&gt;, getter and setter and few more.&lt;/p&gt;

&lt;p&gt;Thank you! Do share 🤗&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>linux</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Simplifying Computational Complexity {time and space}</title>
      <dc:creator>Vikram Sahu </dc:creator>
      <pubDate>Thu, 26 Mar 2020 13:56:17 +0000</pubDate>
      <link>https://forem.com/pepipost/simplifying-computational-complexity-time-and-space-167</link>
      <guid>https://forem.com/pepipost/simplifying-computational-complexity-time-and-space-167</guid>
      <description>&lt;h3&gt;
  
  
  &lt;b&gt;Introduction&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;When someone wants to master computer programming, the best way to start is to learn the complexity of the system. Before you start with coding common questions you should ask yourself are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why should I write the program in this way only?&lt;/li&gt;
&lt;li&gt;What will be the benefit of this program? &lt;/li&gt;
&lt;li&gt;How many resources my program will consume?&lt;/li&gt;
&lt;li&gt;How fast it will execute?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These questions will help you write efficient code. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Computational complexity is all about the writing optimized, efficient and blazing fast programs/code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this blog, you will be going through a few amazing theories of the computer system with examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;Before learning complexity&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FxXlzVCa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sr15j62pg30a6nlxvk9u.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FxXlzVCa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sr15j62pg30a6nlxvk9u.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's learn a bit about an algorithm:&lt;/p&gt;

&lt;p&gt;A sequence of logical computation is called as the algorithm of the program. These algorithms are analyzed by calculating their time or space complexity. It is proved that your algorithm will always execute in worst-case complexity or an average-case complexity.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://en.wikipedia.org/wiki/Worst-case_complexity"&gt;Worst-case complexity&lt;/a&gt;: Maximum resource utilized by your algorithm to execute with respect to the number of inputs.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://en.wikipedia.org/wiki/Average-case_complexity"&gt;Average-case complexity&lt;/a&gt;: Average resource utilized by your algorithm to execute with respect to the number of inputs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope now you are getting a bit of an idea about the complexity theory. Let's dive deep to clear all our doubts...&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;Topics:&lt;/b&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Resources.&lt;/li&gt;
&lt;li&gt;Asymptotic complexity.&lt;/li&gt;
&lt;li&gt;Computational models.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;1. Resources&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;What are the resources as per you? &lt;br&gt;
You might be thinking Human, keyboard, electricity, CPU, monitor &amp;amp; all the hardware stuff that you need while using your system then that is wrong❌.&lt;/p&gt;

&lt;p&gt;The actual resource that I will be talking about is &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Time.&lt;/li&gt;
&lt;li&gt;Space. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;Time complexity&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The time complexity of an algorithm is measured irrespective of hardware and software associated with the system. The complexity considers the maximum time required to run an algorithm which is measured in asymptotic notation.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Space complexity&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The amount of memory your algorithm requires to run is called space complexity.&lt;/p&gt;

&lt;p&gt;Other complexities are arithmetic complexities which depend on the arithmetic computation that has been used in the algorithm and totally depends upon the size of input n.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;2. Asymptotic Complexity&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;It is difficult to describe the compute of an algorithm precisely which falls between the worst-case and the average-case complexity. So in order to calculate the near to accurate complexity, it is always better to keep the input size n as infinity.&lt;/p&gt;

&lt;p&gt;These asymptotic complexities are the boundary limits of an algorithm that includes upper bound(big-oh notation), lower bound(big-omega) and the tight bound(big-theta).&lt;/p&gt;

&lt;p&gt;If you are pretty confident that your algorithm is good and won't hamper your system computational complexity below is the table of complexities you can assume your algorithm might take.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VS7Kv-3J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mfr441x473bzh75a1s8b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VS7Kv-3J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mfr441x473bzh75a1s8b.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For analyzing any algorithm, it is recommended to consider the big-oh notation because it helps us to get the idea of the upper limit of the execution time of the algorithm.&lt;/p&gt;

&lt;p&gt;I would recommend a 5 minutes read on &lt;a href="https://www.hackerearth.com/practice/basic-programming/complexity-analysis/time-and-space-complexity/tutorial/"&gt;hackerearth&lt;/a&gt; before proceeding further.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;3. Computation Models&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j2ymAa6z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1i74s1evm0h6hzu6gijl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j2ymAa6z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1i74s1evm0h6hzu6gijl.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is one of the vast topics which can be totally debatable. The model of computation describes how an output of the mathematical expression is computed when input is given. Similarly, the algorithms rely on these mathematical operations. So it is very important to choose the correct model for computation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;b&gt;&lt;u&gt;Deterministic models&lt;/u&gt;&lt;/b&gt;: These models are the exact opposite of random. It helps us to predict the exact event that will occur in the future without any involvement of randomness. So if you have some data you can predict the exact outcome with 100% certainty. for example :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rolling a fair die.&lt;/li&gt;
&lt;li&gt;Calculating Kelvin using Celsius.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Non-Deterministic models&lt;/u&gt;&lt;/b&gt;: These models are the opposite of deterministic where you will start with some sort of straightforward events later randomness will be getting added to it. Here you don't have the idea of what will be the future event. Since every time you run you will get a different output. In order to differentiate you can consider the below image.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6VVDlwrO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ye08qti793qvsko1508b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6VVDlwrO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ye08qti793qvsko1508b.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;&lt;u&gt;Quantum computing models&lt;/u&gt;&lt;/b&gt;:  These models follow the rules of quantum mechanics(the fundamental theory of physics describing the properties of nature.) The very famous example of quantum computing is AI(Artificial Intelligent). you can find more examples &lt;a href="https://www.forbes.com/sites/bernardmarr/2017/07/10/6-practical-examples-of-how-quantum-computing-will-change-our-world/#22fdd32c80c1"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Tw6QCMuF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xn24ga3jka60z1r57jhv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tw6QCMuF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/xn24ga3jka60z1r57jhv.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Concluding...&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;Any algorithm without proper computational logic is just a waste of resources. you can save those resources or use them in a better way by optimizing, building concise code better.&lt;/p&gt;

&lt;p&gt;I hope you understood the very basic fundamentals of Complexity. Do share &amp;amp; comment! 🤗&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>beginners</category>
      <category>productivity</category>
      <category>design</category>
    </item>
    <item>
      <title>Learning ES6/JavaScript - Part 1</title>
      <dc:creator>Vikram Sahu </dc:creator>
      <pubDate>Wed, 25 Mar 2020 15:38:27 +0000</pubDate>
      <link>https://forem.com/sahuvikramp/learning-es6-javascript-part-1-1i3l</link>
      <guid>https://forem.com/sahuvikramp/learning-es6-javascript-part-1-1i3l</guid>
      <description>&lt;p&gt;&lt;em&gt;Note: javascript &amp;amp; java both are very different from each other&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is javascript?
&lt;/h3&gt;

&lt;p&gt;Javascript is a programming language that was developed to add life to web pages ie. displaying realtime props by loading pages dynamically.&lt;/p&gt;

&lt;p&gt;Anything &amp;amp; everything you are browsing on the internet has javascript in it. Right from googling things to scrolling videos to reading blogs, Even this blog is having Javascript. Isn't it impressive? let's dive deep.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Life to webpages, How?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fr-iZnPD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/c60tzxpa4tuv4u6qsc91.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fr-iZnPD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/c60tzxpa4tuv4u6qsc91.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The HTML (&lt;em&gt;structure&lt;/em&gt;) is just a skeleton for your web page and CSS (&lt;em&gt;style&lt;/em&gt;) is all about beautifying the web page but what about all the major logical things?&lt;/p&gt;

&lt;p&gt;Here comes the JavaScript (&lt;em&gt;behavior&lt;/em&gt;) who is responsible for handling each and every behavior of your webpage.&lt;/p&gt;

&lt;p&gt;Common Behavior includes :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Action to be taken when the button is clicked.&lt;/li&gt;
&lt;li&gt;Pop-ups to notify your user with information.&lt;/li&gt;
&lt;li&gt;Scrolling and Animations. &lt;/li&gt;
&lt;li&gt;Tracking and capturing data (scrapping).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What is ES6? Is it different from Javascript?
&lt;/h3&gt;

&lt;p&gt;As per &lt;a href="https://en.wikipedia.org/wiki/ECMAScript"&gt;Wikipedia&lt;/a&gt;, ES or ECMAScript is a scripting language specification that was introduced to standardized Javascript. ES6 is the 6th version of ECMAScript which was released in 2015 which brought some changes to javascript. I will be discussing those changes in this blog which will start from very basics.&lt;/p&gt;

&lt;p&gt;Before starting I would recommend you going through basics of &lt;a href="https://javascript.info/first-steps"&gt;Javascript&lt;/a&gt; suggested by the Open source guy &lt;a href="//twitter.com/ameerthehacker"&gt;&lt;b&gt;Ameer&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Topics
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Declaration and scope: Let vs var vs const&lt;/li&gt;
&lt;li&gt;Arrow functions&lt;/li&gt;
&lt;li&gt;for..of vs for..in&lt;/li&gt;
&lt;li&gt;Spread attributes&lt;/li&gt;
&lt;li&gt;Map &amp;amp; Set&lt;/li&gt;
&lt;li&gt;Static methods&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1. Declaration and scope: &lt;b&gt;Let vs var vs const&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;Declaring a variable in javascript is all about using one of these. In simple words &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let is a block scope. &lt;/li&gt;
&lt;li&gt;var is function scope.&lt;/li&gt;
&lt;li&gt;const can be only declared once and its value can't be changed throughout the script. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can assume that the variable declared with &lt;b&gt;var&lt;/b&gt; is defined throughout the program as compared to &lt;b&gt;let&lt;/b&gt;. Consider the below 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="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// output:60&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;//console.log("value of a : " + a); &lt;/span&gt;
&lt;span class="c1"&gt;//if above uncommented "error : *ReferenceError: a is not defined*"&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;value of b : &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 40&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I think the above block of code is self-explanatory. The scope of &lt;b&gt;let&lt;/b&gt; is within the &lt;b&gt;if block&lt;/b&gt; and if you try to access the variable outside the block it will throw an error, but &lt;b&gt;var&lt;/b&gt; will be accessible throughout the program within the if block and outside also. &lt;/p&gt;

&lt;p&gt;Using &lt;b&gt;const&lt;/b&gt;:&lt;br&gt;
The difference between const and other variable declaration are &lt;b&gt;const&lt;/b&gt; cannot be reassigned. let's consider the below 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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PI&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="c1"&gt;//can't be changed through the program&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;c_o_c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;PI&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c_o_c&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The value of PI can't be change so it will remain same through out the program where other values can change dynamically.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Arrow Functions (() =&amp;gt;)
&lt;/h3&gt;

&lt;p&gt;A simplest and concise way of defining the function better than function expression. let's learn by 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="c1"&gt;//The older approach&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;n2&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;n1&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;n2&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This is older approach : &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;54&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="c1"&gt;//The new approach&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;es6_sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;n2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;The new approach : &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;n1&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;n2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;es6_sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;65&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above example is simple and self-explanatory.Its straightforward. &lt;/p&gt;

&lt;h3&gt;
  
  
  3. for..in vs for..of
&lt;/h3&gt;

&lt;p&gt;Humans are for innovation not for doing the same tasks repeatedly but machines are built for doing such repetitive tasks without getting tired. Here come the &lt;b&gt;Loops&lt;/b&gt; for doing repetitive task. For loop is one of the widely used loops in computer science. Let's dive deep with these for..of and for..in &lt;/p&gt;

&lt;p&gt;&lt;b&gt;for..in&lt;/b&gt;&lt;br&gt;
This loop over the enumerable properties of an object. The syntax looks something like:&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;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;variable&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;object&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="c1"&gt;// your logic here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;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="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="na"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Vikram&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sahu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  
&lt;span class="p"&gt;};&lt;/span&gt; 
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="c1"&gt;// prints the value of object&lt;/span&gt;
  &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt; 

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

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;for..of&lt;/b&gt;&lt;br&gt;
This loops over the iterable data structure like an array, maps, strings, nodes, and lists. The syntax looks something like this&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;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;variable&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;iterable&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="c1"&gt;// your logic here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;pineapple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mango&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;watermelon&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;banana&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;fruit&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruit&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;
  
  
  4.Spread attributes
&lt;/h3&gt;

&lt;p&gt;As the name suggests Spread attributes helps to spread the expression. ie. it converts the list of elements to an array.&lt;/p&gt;

&lt;p&gt;Example without Spread attribute:&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;s_att&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;ele&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;ele&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;s_att&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;51&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;12&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;98&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;08&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see the above example is straightforward where it accepts the array and give the sum of an array.&lt;/p&gt;

&lt;p&gt;Example with Spread attribute:&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;s_att&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;ele&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;ele&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;s_att&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;51&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;12&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;98&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;08&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;small task for you spot the difference.. you have 3 sec &lt;/p&gt;

&lt;p&gt;1.. 2.. 3..&lt;/p&gt;

&lt;p&gt;I hope you have so very small change we have just converted the argument from array to single arguments and convert &lt;b&gt;(arr)&lt;/b&gt; to &lt;b&gt;(...arr)&lt;/b&gt; in the function.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Map &amp;amp; Set
&lt;/h3&gt;

&lt;p&gt;&lt;b&gt;MAP&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;A map is a collection of keyed data item the same as an object but the difference is it allows the key of any type.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Methods &amp;amp; Properties 

&lt;ul&gt;
&lt;li&gt;new Map()          : creates new map. &lt;/li&gt;
&lt;li&gt;map.set(key,value) : adds/store the value by key&lt;/li&gt;
&lt;li&gt;map.get(key)       : greturns the value by the key, undefined if key doesn’t exist in map.&lt;/li&gt;
&lt;li&gt;map.has(key)       : returns true if key exists&lt;/li&gt;
&lt;li&gt;map.delete(key)    : removes key from the map&lt;/li&gt;
&lt;li&gt;map.clear()        : removes everything from map&lt;/li&gt;
&lt;li&gt;map.size()         : returns the count of map
&lt;/li&gt;
&lt;/ul&gt;


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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;map&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Vikram&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;designation&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Developer Evangelist&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// looping over map&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;ele_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ele_value&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ele_key&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; -- &amp;gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;ele_value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;  &lt;span class="c1"&gt;//return all the keys within map&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;  
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;// return all the value within map&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;designation&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clear&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;SET&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;A set is a unique type collection that has a "set of values"(without keys), where each value occurs once(no duplicate values will be inserted). Let's assume a simple 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="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;mysets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;mysets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&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="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;mysets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&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="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;mysets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&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="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// We are adding duplicate value.&lt;/span&gt;
&lt;span class="c1"&gt;//looping over sets&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;mysets&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;mysets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&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="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;mysets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&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="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Static methods
&lt;/h3&gt;

&lt;p&gt;You can assign a method to the class function itself, not to its "prototype". Such methods are called static. you can find the syntax as follows:&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;class&lt;/span&gt; &lt;span class="nx"&gt;Mydata&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="nx"&gt;CallMe&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello i am static function&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;Mydata&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CallMe&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// returns "Hello i am static function"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;what you need to notice is that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I have not written &lt;b&gt;function&lt;/b&gt; within the class still I can access the function.&lt;/li&gt;
&lt;li&gt;I have called the function without creating an instance of the class.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;&lt;b&gt;Concluding...&lt;/b&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Javascript/ES is a weird but amazing language. This was the start of my learning curve will update with the further path soon. &lt;/p&gt;

&lt;p&gt;I hope you like the blog. Do share! 🤗 &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>linux</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Where should I save my passwords ? To more specific which editor ?</title>
      <dc:creator>Vikram Sahu </dc:creator>
      <pubDate>Sat, 09 Nov 2019 06:47:50 +0000</pubDate>
      <link>https://forem.com/sahuvikramp/where-should-i-save-my-passwords-to-more-specific-which-editor-244i</link>
      <guid>https://forem.com/sahuvikramp/where-should-i-save-my-passwords-to-more-specific-which-editor-244i</guid>
      <description>&lt;p&gt;I think vim for Linux&lt;/p&gt;

</description>
      <category>security</category>
      <category>discuss</category>
      <category>watercooler</category>
    </item>
  </channel>
</rss>
