<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: OMKAR AGRAWAL</title>
    <description>The latest articles on DEV Community by OMKAR AGRAWAL (@omkaragrawal).</description>
    <link>https://dev.to/omkaragrawal</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%2F109132%2F64969c6e-9c74-4148-8c8c-6379239f7b73.jpeg</url>
      <title>DEV Community: OMKAR AGRAWAL</title>
      <link>https://dev.to/omkaragrawal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omkaragrawal"/>
    <language>en</language>
    <item>
      <title>Everything about APIs</title>
      <dc:creator>OMKAR AGRAWAL</dc:creator>
      <pubDate>Fri, 07 May 2021 10:39:10 +0000</pubDate>
      <link>https://dev.to/omkaragrawal/everything-about-apis-1ccc</link>
      <guid>https://dev.to/omkaragrawal/everything-about-apis-1ccc</guid>
      <description>&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10nemykkaq0i6xa5ovq3.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10nemykkaq0i6xa5ovq3.png" alt="API Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Content List:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Beginner's Content&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Content for the Skillful&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Advanced Content&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resources to Learn More&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;List of Public APIs&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;About Me&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;/h2&gt;
&lt;p id="beginners"&gt;API for Beginners&lt;/p&gt;

&lt;p&gt;Let’s start with some basics&lt;/p&gt;

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

&lt;p&gt;It is called Application Programming Interface. It is used to hide something very very complex behind something as simple as a function call. Wikipedia explains it as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In &lt;a href="https://en.wikipedia.org/wiki/Computing" rel="noopener noreferrer"&gt;computing&lt;/a&gt;, an &lt;strong&gt;application programming interface&lt;/strong&gt; (&lt;strong&gt;API&lt;/strong&gt;) is an &lt;a href="https://en.wikipedia.org/wiki/Interface_(computing)" rel="noopener noreferrer"&gt;interface&lt;/a&gt; that defines interactions between multiple &lt;a href="https://en.wikipedia.org/wiki/Software_application" rel="noopener noreferrer"&gt;software applications&lt;/a&gt; or mixed &lt;a href="https://en.wikipedia.org/wiki/Computer_hardware" rel="noopener noreferrer"&gt;hardware&lt;/a&gt;-software intermediaries.&lt;a href="https://en.wikipedia.org/wiki/API#cite_note-1" rel="noopener noreferrer"&gt;[1]&lt;/a&gt; It defines the kinds of &lt;a href="https://en.wikipedia.org/wiki/System_call" rel="noopener noreferrer"&gt;calls&lt;/a&gt; or requests that can be made, how to make them, the &lt;a href="https://en.wikipedia.org/wiki/Data_type" rel="noopener noreferrer"&gt;data formats&lt;/a&gt; that should be used, the conventions to follow.        &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Duh! explain it more simply !!!
&lt;/h3&gt;

&lt;p&gt;I’ll take an example, Our example for this article will be a restaurant. Let’s say today you had an awesome day (hope that you did) and you do not want to cook for yourself, so you are out for dinner in as awesome a restaurant as your day. What do you do here? You give the order to the waiter. What does he do? he brings you your food. So in this scenario, the waiter is an API, and he hides all the complexity of cooking food, decorating it on a plate, etc. This is what an API is (in a gist).&lt;/p&gt;


&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;/h2&gt;
&lt;p id="skillful"&gt;API for -   Skillful&lt;/p&gt;

&lt;h3&gt;
  
  
  So, are there multiple types or what?
&lt;/h3&gt;

&lt;p&gt;Yes, as in every programming concept, this too has multiple types.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open APIs:&lt;/strong&gt; These are also known as public APIs (sometimes called external APIs). These almost all of the time require an API key to be accessed. They are open for everyone to be used. They can be used by developers, corporates, and anyone else.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Partner APIs:&lt;/strong&gt; Kind of very similar to Open APIs, but are restricted to be accessed only via a partnered gateway. If you have much experience in deployment over GCP or AWS or similar, and you use some APIs like SendGrid, Mailgun, etc via GCP/AWS/etc then you are using the partnered version of the APIs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Composite APIs:&lt;/strong&gt; These are APIs that allow to access multiple APIs together. Have you ever tried ordering something from a website without registering? and have you noticed that it automatically creates an account for you based on the order details? Yes, exactly, most probably that website used a composite API to place the order and create an account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Internal APIs:&lt;/strong&gt; These are exactly the opposite of open APIs. They are supposed to be used internally by the company itself. They allow different teams or sections of a business to consume each other’s tools, data, and programs. It helps in maintaining security, access control, and the trails of process.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are the types of Web Service APIs (APIs that can be accessed over HTTP or the internet in simple words). They are generalized as Third Party APIs.&lt;/p&gt;

&lt;p&gt;Another most common category of API is Browser APIs. These APIs are accessible in your browser for browser. Then there are product APIs that are meant only for the product that they are developed for and will be accessible only when you install that product.  There is a whole set of Standard APIs as well, which are the proposed standards, these can be found on Openstack API specifications and W3C, and more. Another set of APIs are called System/Embedded APIs, these APIs are more specific to the system, like Windows system APIs, mobile fingerprint API, etc.&lt;/p&gt;

&lt;p&gt;For this article, we will only focus on Web Service APIs&lt;/p&gt;


&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;/h2&gt;
&lt;p id="advance"&gt;API for -   Advanced Readers&lt;/p&gt;

&lt;p&gt;Getting back to our example, where you have reached the restaurant and have ordered the food. (This was the part of using the front end to call the API)&lt;/p&gt;

&lt;p&gt;Have you ever wondered what and how does the waiter writes so that the cook knows exactly what to cook and how to cook, here comes our next question&lt;/p&gt;

&lt;h3&gt;
  
  
  Should the APIs be called in specific ways or are they smart enough to understand our natural way of speaking?
&lt;/h3&gt;

&lt;p&gt;The answer here is, obviously, APIs have some architecture and protocols. So an API protocol defines the rules for API calls. &lt;/p&gt;

&lt;p&gt;Majorly there are 5 API architectures:&lt;br&gt;
1 SOAP&lt;br&gt;
2 REST&lt;br&gt;
3 RPC&lt;br&gt;
4 Websckets and Webhooks&lt;br&gt;
5 GraphQL&lt;br&gt;
I'll explain all of them in a brief.&lt;/p&gt;

&lt;h4&gt;
  
  
  1) SOAP (Simple Object Access Protocol)
&lt;/h4&gt;

&lt;p&gt;Prior to the Rest, this was one of the most used protocols, it is heavy for transport, but provides better security than the Rest API. It is intended to be extensible and neutral. It uses XML as a format to transfer data. It also uses WSDL (Web Services Definition Language) to publish a definition of its interface. So what it means is that it uses WSDL to publish the format in which the response will be received( in very general and layman terms ).&lt;/p&gt;

&lt;h4&gt;
  
  
  2) REST (REpresentational State Transfer)
&lt;/h4&gt;

&lt;p&gt;In today's internet, REST is one of the most followed architectures ( it is not considered as a protocol). Most of the services offered today use REST. It requires the application to adhere to some rules (called architectural constraints/principles).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The system should be implemented over &lt;strong&gt;server-client architecture&lt;/strong&gt; (which most of the time is satisfied in general). This makes the system flexible as different components of the system can be changed independently.&lt;/li&gt;
&lt;li&gt;The system should be &lt;strong&gt;Stateless&lt;/strong&gt;: This means that the client (generally the frontend) must include all the information for the server to fulfill the request, it can be as query parameters, headers, or URI. The server should not store/maintain any states (can be thought of as sessions), all of the information should be provided by the client itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cacheability&lt;/strong&gt;: This constraint is pretty straight, but can trouble you sometimes especially while debugging. It says that a client can cache a response, so the response must explicitly state that it can be cached or not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layered system&lt;/strong&gt;: It is also pretty straightforward, it says that the system must exist in layered format, so irrespective of whether the communication happens directly or via load balancer or different intermediaries, the API should be able to communicate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uniform Interface&lt;/strong&gt;: This is one of the most important constraints, it says that the interaction between the client and server should be uniform across all the clients ( irrespective of device or application for eg. mobile apps, web, etc). This further gets broken down into 4 sub principles: &lt;strong&gt;Resource-Based&lt;/strong&gt;, &lt;strong&gt;Manipulation of Resources Through Representations&lt;/strong&gt;, &lt;strong&gt;Self-descriptive Messages&lt;/strong&gt;, &lt;strong&gt;Hypermedia as the Engine of Application State (HATEOAS)&lt;/strong&gt;.
I won't be explaining these in more detail as they can be a whole blog themselves and have already have written a big para on rest, but you can visit &lt;a href="https://stackoverflow.com/q/25172600/8217589" rel="noopener noreferrer"&gt;Stackoverflow&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&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%2Fcontent.altexsoft.com%2Fmedia%2F2020%2F05%2Fword-image-57.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%2Fcontent.altexsoft.com%2Fmedia%2F2020%2F05%2Fword-image-57.png" alt="Richardson Maturity Model as a goalpost to achieving truly complete and useful APIs"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Richardson Maturity Model as a goalpost to achieving truly complete and useful APIs, Source: &lt;a href="https://nordicapis.com/what-is-the-richardson-maturity-model" rel="noopener noreferrer"&gt;&lt;em&gt;Kristopher Sandoval&lt;/em&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3) RPC (Remote Procedure Calls)
&lt;/h4&gt;

&lt;p&gt;This is a very interesting API Architecture. In the above APIs, the only thing that happens is the transfer of data, but RPC is different, it is designed to call a function instead of simply transferring data. So if you are familiar with programming, then the name itself will suggest that it calls procedures. If used for CRUD (Create, Read, Update, Delete) operations, it is like sending data fields like normally we would do, but there's a downside to this, and that is, the client is entirely in charge of everything. The client must know which methods (endpoints) to hit at what time, to construct its workflow out of the un-descriptive endpoints.&lt;/p&gt;

&lt;p&gt;RPC is a concept that has a lot of specifications and is implemented using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;a href="https://en.wikipedia.org/wiki/XML-RPC" rel="noopener noreferrer"&gt;XML-RPC&lt;/a&gt;: To give a brief, It simply uses XML as a data transfer format. It is also older than SOAP. XML-RPC uses minimum bandwidth and is much simpler than SOAP. XML-RPC was problematic because ensuring data types of XML payloads is tough. In XML, a lot of things are just strings.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://en.wikipedia.org/wiki/JSON-RPC" rel="noopener noreferrer"&gt;JSON-RPC&lt;/a&gt;: This protocol is similar to XML-RPC but instead of using XML format to transfer data it uses JSON. It proved out to be better than XML-RPC because to some extent it helped with the issue of data types that XML had, but it had troubles in differentiating different data formats like integers and decimals.&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://en.wikipedia.org/wiki/SOAP" rel="noopener noreferrer"&gt;Simple Object Access Protocol (SOAP)&lt;/a&gt;: SOAP-RPC tried to resolve the issue with JSON-RPC and XML-RPC. For JSON-RPC you need to layer metadata on top to describe things such as which fields correspond to which data types. This became part of the basis for SOAP, which used &lt;a href="https://wikipedia.org/wiki/XML_schema" rel="noopener noreferrer"&gt;XML Schema&lt;/a&gt; and a &lt;a href="https://wikipedia.org/wiki/Web_Services_Description_Language" rel="noopener noreferrer"&gt;Web Services Description Language (WSDL)&lt;/a&gt; to explain what went where and what it contained.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the standardized formats of RPC is called &lt;a href="https://grpc.io" rel="noopener noreferrer"&gt;gRPC&lt;/a&gt; it is widely accepted and used in the industry, it has been created and standardized by Google (internally the previous version was called &lt;strong&gt;Stubby&lt;/strong&gt;). It is &lt;a href="https://github.com/grpc/grpc" rel="noopener noreferrer"&gt;open-sourced&lt;/a&gt;. By default, gRPC uses &lt;a href="https://developers.google.com/protocol-buffers/docs/overview" rel="noopener noreferrer"&gt;Protocol Buffers&lt;/a&gt; (although it can be used with other data formats such as JSON). &lt;a href="https://grpc.io/about/#whos-using-grpc-and-why" rel="noopener noreferrer"&gt;You can see who uses gRPC and why here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  4) Webhooks / Websockets API
&lt;/h4&gt;

&lt;p&gt;This is for real-time APIs where data is streamed back to the calling system using technology like Websockets or Webhooks. &lt;/p&gt;

&lt;p&gt;Sometimes &lt;strong&gt;Webhooks&lt;/strong&gt; is referred to as a reverse API, but this isn’t entirely true. They don’t run backward, but instead, there doesn’t need to be a request initiated on your end, data is sent whenever there’s new data available. Webhooks are commonly used to perform smaller requests and tasks, however, there are situations where a webhook is more appropriate than an entire API.  &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;WebSocket API&lt;/strong&gt; is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Even though for this article I have categorized them under the same umbrella, these two technologies are different.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://en.wikipedia.org/wiki/Webhook" rel="noopener noreferrer"&gt;Webhooks&lt;/a&gt; are for server-to-server communication. They work by one server telling another server
that it wants data sent to a certain URL when something happens.&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://en.wikipedia.org/wiki/WebSocket" rel="noopener noreferrer"&gt;Websockets&lt;/a&gt;  are (usually) for a server to browser communication. The server hosts a WebSocket server, and clients can open a connection to that server. This is
popular now mostly because it is faster and less resource-hogging than
older ways of solving the problem, like  &lt;a href="https://stackoverflow.com/questions/11077857/what-are-long-polling-websockets-server-sent-events-sse-and-comet" rel="noopener noreferrer"&gt;long-polling&lt;/a&gt;/&lt;a href="http://en.wikipedia.org/wiki/Comet_%28programming%29" rel="noopener noreferrer"&gt;COMET&lt;/a&gt;. It is  &lt;a href="https://github.com/liris/websocket-client" rel="noopener noreferrer"&gt;possible to connect 2 servers using WebSockets&lt;/a&gt;, but that is not usually what they are used for.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;This note was referenced from this &lt;a href="https://stackoverflow.com/a/24747947/8217589" rel="noopener noreferrer"&gt;Stackoverflow Reply&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are also Pub/Sub APIs that I have not covered in this post. It works on similar principles as these.&lt;/p&gt;

&lt;p&gt;Another newer technology that I haven't written in detail is WebRTC, it is somewhat similar to web sockets but one of the major differences is that it works in real-time, especially used for audio/video communications. It is an emerging technology, with its usage increasing by the day. To get some basic understanding between WebRTC and Webscokets to refer to &lt;a href="https://bloggeek.me/webrtc-vs-websockets" rel="noopener noreferrer"&gt;this article&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  5) GraphQL
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;GraphQL is a query language for APIs and a runtime for fulfilling&lt;br&gt;
those queries with your existing data. GraphQL provides a complete and&lt;br&gt;
understandable description of the data in your API gives clients the&lt;br&gt;
power to ask for exactly what they need and nothing more makes it&lt;br&gt;
easier to evolve APIs over time, and enables powerful developer tools.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From the official &lt;a href="https://graphql.org" rel="noopener noreferrer"&gt;GraphQL website&lt;/a&gt;&lt;br&gt;
This is a somewhat newer API technology. GraphQL APIs have a hypermedia-like ability to use a single query to fetch the required data across multiple resources. But GraphQL APIs also borrow from concepts that we’ve observed in both REST and RPC-styled APIs.&lt;/p&gt;

&lt;p&gt;It is a technology developed by Facebook in 2012. GraphQL was used internally for their mobile applications to reduce network usage employing its specific data-fetching capabilities. Since GraphQL specifications and reference implementation in JavaScript were open-sourced in 2015, major programming languages now support it, including Python, Java, C#, Node.js, and more. The GraphQL ecosystem is expanding with libraries and powerful tools like Apollo, GraphiQL, and GraphQL Explorer.&lt;/p&gt;

&lt;p&gt;To understand the differences in REST and GraphQL refer to the table below:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcontent.altexsoft.com%2Fmedia%2F2019%2F03%2Fword-image-5.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%2Fcontent.altexsoft.com%2Fmedia%2F2019%2F03%2Fword-image-5.png" alt="https://content.altexsoft.com/media/2019/03/word-image-5.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Major differences in GraphQL and REST endpoints (Image taken from AltexSoft article)&lt;/em&gt;&lt;/p&gt;


&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;/h2&gt;
&lt;p id="conclusion"&gt; Conclusion &lt;/p&gt;

&lt;p&gt;So now you have a good understanding of how the waiter (in the case of the web a client) takes your order (the actions performed on UI) and organizes it accordingly so that a cook can prepare your meal (backend can process your data). These help in keeping the flow seamless even if there are tens of consecutive customers ordering (many clients interacting on the web). &lt;/p&gt;

&lt;p&gt;Indeed, the web is a wonderful restaurant that is open and ready 24/7/365 to serve you your order. Now with this knowledge, I'll end the article, and hope to see your amazing dish (project) served (hosted) in the restaurant (web). &lt;/p&gt;

&lt;p&gt;Below are few resources that I have referred to for this article and otherwise. &lt;/p&gt;

&lt;p&gt;I have also collected few Public APIs for you to learn, test, and use as per your needs. &lt;/p&gt;

&lt;p&gt;If you want to learn, how to test and use an API from basics, then I'll recommend &lt;a href="https://www.postman.com/postman/workspace/postman-student-api-101-workshop/overview" rel="noopener noreferrer"&gt;Postman API 101 Public Workspace&lt;/a&gt;. Follow this to get a better grasp. They also have a webinar on this you can see it on &lt;a href="https://www.postman.com/webinars/apis-101" rel="noopener noreferrer"&gt;their webinars page&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;/h2&gt;
&lt;p id="learnMore"&gt; Resources to Learn More &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.postman.com/soap-vs-rest/" rel="noopener noreferrer"&gt;SOAP vs REST on Postman Blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://apihandyman.io/do-you-really-know-why-you-prefer-rest-over-rpc" rel="noopener noreferrer"&gt;Why rest over RPC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.atlassian.com/server/confluence/confluence-xml-rpc-and-soap-apis" rel="noopener noreferrer"&gt;SOAP and XML-RPC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Kikobeats/awesome-api" rel="noopener noreferrer"&gt;Awesome List for resources on APIs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/arainho/awesome-api-security" rel="noopener noreferrer"&gt;Awesome List for APIs Security&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.altexsoft.com/blog/soap-vs-rest-vs-graphql-vs-rpc" rel="noopener noreferrer"&gt;AltexSoft SOAP vs REST vs Graph vs RPC&lt;/a&gt;:  It is also used as one of the references for this article.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.smashingmagazine.com/2016/09/understanding-rest-and-rpc-for-http-apis" rel="noopener noreferrer"&gt;SmashingMagzine Understanding REST and RPC&lt;/a&gt;: A must-read to clear out the confusion and use case of RPC and REST. It is also used as one of the references for this article.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apisyouwonthate.com/blog/understanding-rpc-rest-and-graphql" rel="noopener noreferrer"&gt;Understanding RPC, REST, GraphQL&lt;/a&gt;: Another must-read for a better understanding of these APIs. It is also used as one of the references for this article.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mathieu.fenniak.net/the-api-checklist" rel="noopener noreferrer"&gt;Web API Checklist by Mathieu Fenniak&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;#### SOAP Resources&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.altexsoft.com/blog/engineering/what-is-soap-formats-protocols-message-structure-and-how-soap-is-different-from-rest" rel="noopener noreferrer"&gt;A wonderful blog by AltexSoft&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.postman.com/soap-api-definition" rel="noopener noreferrer"&gt;SOAP API 101 by Postman&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stoplight.io/api-types/soap-api" rel="noopener noreferrer"&gt;Blog on SOAP API by Stoplight&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://en.wikipedia.org/wiki/SOAP" rel="noopener noreferrer"&gt;Wikipedia&lt;/a&gt; 
#### Rest Resources&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.blog/2020/03/02/best-practices-for-rest-api-design/" rel="noopener noreferrer"&gt;StackOverflow Blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://blog.postman.com/rest-api-definition" rel="noopener noreferrer"&gt;Rest 101 on Postman Blog&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/architecture/best-practices/api-design" rel="noopener noreferrer"&gt;Microsoft Rest API Design Blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md" rel="noopener noreferrer"&gt;Microsoft REST API guidelines&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm" rel="noopener noreferrer"&gt;The chapter on REST in Roy Fielding's dissertation on Network Architecture, "Architectural Styles and the Design of Network-based Software Architectures"&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.oreilly.com/content/how-to-design-a-restful-api-architecture-from-a-human-language-spec" rel="noopener noreferrer"&gt;How to design a RESTful API architecture from a human-language spec By Filipe Ximenesand Flávio Juvenal on O'Reilly&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;a href="https://www.restapitutorial.com/lessons/whatisrest.html" rel="noopener noreferrer"&gt;Restapitutorial&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;

&lt;a href="https://github.com/marmelab/awesome-rest" rel="noopener noreferrer"&gt;Awesome list for resources on REST APIs&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Representational_state_transfer" rel="noopener noreferrer"&gt;Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Websockets / Webhooks
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.html5rocks.com/en/tutorials/websockets/basics" rel="noopener noreferrer"&gt;Websockets on Html5rocks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.blog/2019/12/18/websockets-for-fun-and-profit" rel="noopener noreferrer"&gt;Websockets for fun and profit on Stackoverflow blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.websocket.org/quantum.html" rel="noopener noreferrer"&gt;Benefits of Websockets on Websocket.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.postman.com/postman-engineering-million-concurrent-connections" rel="noopener noreferrer"&gt;How Postman Engineering Handles a Million Concurrent Connections&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://zapier.com/blog/what-are-webhooks" rel="noopener noreferrer"&gt;What are webhooks? on Zapier Blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.github.com/en/developers/webhooks-and-events" rel="noopener noreferrer"&gt;Webhooks on Github&lt;/a&gt;: A amazing way to learn webhooks using Github's webhooks API.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://requestbin.com/blog/working-with-webhooks" rel="noopener noreferrer"&gt;Webhook definitive Guide on Requestbin blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://webhook.site" rel="noopener noreferrer"&gt;Webhook.site&lt;/a&gt;: With this site, you instantly get a unique, random URL that you can use to test and debug Webhooks and HTTP requests, as well as to create your own workflows using the &lt;a href="https://docs.webhook.site/custom-actions.html" rel="noopener noreferrer"&gt;Custom Actions&lt;/a&gt; graphical editor or &lt;a href="https://docs.webhook.site/webhookscript.html" rel="noopener noreferrer"&gt;WebhookScript&lt;/a&gt;, a simple scripting language, to transform, validate and process HTTP requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  GraphQL
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.howtographql.com" rel="noopener noreferrer"&gt;HowToGraphql&lt;/a&gt;: A website built to teach GraphQL entirely for free, a must-visit website.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://graphql.org/learn" rel="noopener noreferrer"&gt;Official GraphQL Docs to learn GraphQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://graphql.org/learn/best-practices" rel="noopener noreferrer"&gt;Official Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.graphqlweekly.com" rel="noopener noreferrer"&gt;GraphQL Weekly Newsletter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.altexsoft.com/blog/engineering/graphql-core-features-architecture-pros-and-cons" rel="noopener noreferrer"&gt;GraphQL Features, Pros, and Cons by AltexSoft&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.redhat.com/en/topics/api/what-is-graphql" rel="noopener noreferrer"&gt;What is GraphQL on Redis Blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techbeacon.com/app-dev-testing/practical-guide-graphql-future-apis" rel="noopener noreferrer"&gt;Practical Guide of GraphQL APIs on Techbeacon&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;/h2&gt;
&lt;p id="publicAPI"&gt;API Collections &lt;/p&gt;

&lt;h4&gt;
  
  
  Mixed Lists
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.postman.com/explore/apis" rel="noopener noreferrer"&gt;A whole list of APIs on Postman&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://free-for.dev/#/?id=apis-data-and-ml" rel="noopener noreferrer"&gt;Free-for-dev List&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/public-apis/public-apis" rel="noopener noreferrer"&gt;List of Public APIs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://apilist.fun" rel="noopener noreferrer"&gt;APIList.fun&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://any-api.com" rel="noopener noreferrer"&gt;Any-api.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://public-apis.io" rel="noopener noreferrer"&gt;Public-apis.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://apis.guru/browse-apis" rel="noopener noreferrer"&gt;APIs guru&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://data.world/datasets/api" rel="noopener noreferrer"&gt;Public Datasets API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.twitter.com/en/docs" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/maps" rel="noopener noreferrer"&gt;Google Maps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.facebook.com/docs" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://core.telegram.org/api" rel="noopener noreferrer"&gt;Telegram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/youtube" rel="noopener noreferrer"&gt;Youtube&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.pinterest.com" rel="noopener noreferrer"&gt;Pinterest&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://api.slack.com/web" rel="noopener noreferrer"&gt;Slack WebAPI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://api.nasa.gov" rel="noopener noreferrer"&gt;Most famous for example purposes, &lt;strong&gt;NASA&lt;/strong&gt; APIs&lt;/a&gt;
#### SOAP

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://documenter.getpostman.com/view/8854915/Szf26WHn?version=latest" rel="noopener noreferrer"&gt;You can find some public APIs and their examples  here from Postman&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.postman.com/cs-demo/workspace/public-soap-apis/overview" rel="noopener noreferrer"&gt;Public SOAP API workspace on Postman&lt;/a&gt;
#### Rest&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;a href="https://www.postman.com/cs-demo/workspace/public-rest-apis/overview" rel="noopener noreferrer"&gt;Public REST API workspace on Postman&lt;/a&gt; &lt;/li&gt;

&lt;li&gt;&lt;a href="https://jsonplaceholder.typicode.com" rel="noopener noreferrer"&gt;JSONPlaceholder fake API for testing and prototyping&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="https://restcountries.eu" rel="noopener noreferrer"&gt;REST countries&lt;/a&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  RPC
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://googleapis.github.io/HowToRPC.html" rel="noopener noreferrer"&gt;Google APIs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/grpc-ecosystem/awesome-grpc" rel="noopener noreferrer"&gt;Awesome gRPC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/shanejonas/awesome-json-rpc" rel="noopener noreferrer"&gt;Awesome-json-RPC&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Webhooks / Websockets
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developers.facebook.com/docs/graph-api/webhooks" rel="noopener noreferrer"&gt;Facebook Webhook API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  GraphQL
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.postman.com/cs-demo/workspace/public-graphql-apis/overview" rel="noopener noreferrer"&gt;Public GraphQL API workspace on Postman&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.facebook.com/docs/graph-api/reference/page" rel="noopener noreferrer"&gt;Facebook Graph API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://moonhighway.com/public-graphql-apis" rel="noopener noreferrer"&gt;Moonhighway list&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;/h2&gt;
&lt;p id="aboutMe"&gt; About Me &lt;/p&gt;

&lt;p&gt;Hey there,&lt;br&gt;
I am Omkar Agrawal a freelance full-stack web developer, currently, I am in the final year of my Bachelors's in Information Technology. I am also a Postman Student Leader and Postman Student Expert. I am a tech enthusiast that loves to read and learn on anything that can increase my knowledge, but especially on technology.&lt;/p&gt;

&lt;p&gt;I am available for Backend / Fullstack development job positions, you can find me on &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://omkaragrawal.dev" rel="noopener noreferrer"&gt;Omkaragrawal.dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://linkedin.com/in/omkaragrawal" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you loved this blog then please support it by giving a thumbs up on this post and on other channels :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://omkaragrawal.medium.com/everything-about-apis-234f26f92a6" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blogs.omkaragrawal.dev/everything-about-apis" rel="noopener noreferrer"&gt;blogs.omkaragrawal.dev&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title># Arrow functions VS Regular functions (scoping of this in function)</title>
      <dc:creator>OMKAR AGRAWAL</dc:creator>
      <pubDate>Fri, 01 Jan 2021 19:30:27 +0000</pubDate>
      <link>https://dev.to/omkaragrawal/arrow-functions-vs-regular-functions-scoping-of-this-in-function-b8g</link>
      <guid>https://dev.to/omkaragrawal/arrow-functions-vs-regular-functions-scoping-of-this-in-function-b8g</guid>
      <description>&lt;p&gt;Yesterday I was going thru HackerRank tutorials of 10 Days of Javascript and had stuck at a problem statement.&lt;/p&gt;

&lt;p&gt;The problem statement was far too very easy to solve (probably why it was for beginners 😜)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://bit.ly/HakerRank-Rectangle" rel="noopener noreferrer"&gt;Problem Statement&lt;/a&gt; :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2278%2F1%2AKy0LyReM73vC9eOIwmbJhQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2278%2F1%2AKy0LyReM73vC9eOIwmbJhQ.png" alt="The problem statement I am referring"&gt;&lt;/a&gt;&lt;em&gt;The problem statement I am referring&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;At first the problem statement looks very trivial and in fact it is.&lt;/p&gt;

&lt;p&gt;If you are not very highly skilled and seasoned JS dev then you would make the same mistake as me 😓.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3640%2F1%2AUn2fdLGYAaNOoofzGj_JPQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3640%2F1%2AUn2fdLGYAaNOoofzGj_JPQ.png" alt="Image of the problematic code"&gt;&lt;/a&gt;&lt;em&gt;Image of the problematic code&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can know your skills if you do/don’t find the above code wrong.&lt;/p&gt;

&lt;p&gt;I believe just like me, you know where the problem lies. At one point in your life of js development you have come across this and would just require to be reminded of how functions are scoped.&lt;/p&gt;

&lt;p&gt;I soon found out the mistake, when I saw the output of the execution and had console logged “this” as a debugging method, the very *&lt;em&gt;Brahmāstr *&lt;/em&gt;(the ultimate weapon) of the developers 😆.&lt;/p&gt;

&lt;p&gt;If you are still asking why it is wrong then please let me explain it to you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem Description
&lt;/h2&gt;

&lt;p&gt;The problem lies in as how the two types of function declaration essentially work, moreover how internally the scoping of functions is done.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://bit.ly/hacks-arrow-function" rel="noopener noreferrer"&gt;Arrow Function&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;There are a bunch of different ways in which arrow functions differ from normal/regular functions (not only in syntax).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Arrow functions don’t have their own this, arguments, super , .prototype .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Arrow functions cannot be used as constructors, hence cannot be used with new keyword.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Since arrow function follow normal variable lookup and also they don’t have their own this, this in arrow function is looked up in the enclosing scope (that is the scope where the arrow function is &lt;strong&gt;called&lt;/strong&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Given that this comes from the surrounding lexical context, strict mode rules with regard to this are ignored.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Arrow functions cannot be bound to any other scopes, since they don’t have their own bindings of this , hence .apply(), .call(), .bind() do not apply (considering their primary usage in concern to this ), what they would do is just pass the parameter (ignoring any value passing to this ).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield" rel="noopener noreferrer"&gt;yield&lt;/a&gt; keyword may not be used in an arrow function's body (except when permitted within functions further nested within it). As a consequence, arrow functions cannot be used as generators. (Referenced from MDN)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So what do all this mean in our issue?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Just for explanation purpose I have saved this in a variable abc and passed it as a parameter to the area function. This helps us to realise that the parameter &lt;em&gt;object *and *this&lt;/em&gt; are equal.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AGfyD2x6WZYW5H7ew3-Ppbg.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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AGfyD2x6WZYW5H7ew3-Ppbg.gif" alt="**Visualizing the problem**"&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;Visualizing the problem&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;TLDR&lt;/strong&gt;: " &lt;strong&gt;this&lt;/strong&gt; ” in the arrow function is not set as the scope of it’s parent as in regular functions, but is set to the reference of the scope in which it is called. (ie the scope of if block)
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;em&gt;SOLUTION&lt;/em&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Regular Function
&lt;/h3&gt;

&lt;p&gt;How regular functions work and differ from arrow functions besides the obvious syntactical difference?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Regular functions have their own bindings of this, arguments, super , .prototype .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;These functions can be used as constructor because they have their own bindings, due to which these can be used with the new keyword.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;this in context to function body, have a little different behavior when used in strict mode as of that when used not used in strict mode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When not used in strict mode then the value of this of function is set to the the context in which the function is declared in. That is, if a function is called as a method of an object, its this is set to the object the method is called on. (Didn’t understand ? Refer the codes below extracted from MDN).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://gist.github.com/Omkaragrawal/be908395f2a273606c08b16178091e55" rel="noopener noreferrer"&gt;&lt;strong&gt;Gist&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AEr6XJxhhT7TXaJ7njb2_ZQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AEr6XJxhhT7TXaJ7njb2_ZQ.png" alt="Value of this in node.js and browser"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ApgnPDw4Oicj4ToK7xe1TDg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ApgnPDw4Oicj4ToK7xe1TDg.png" alt="Value of this in member function of an object"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.When a function is used as a constructor (with the new keyword), its this is bound to the new object being constructed.&lt;/p&gt;

&lt;p&gt;6.When used in strict mode then the value of this of function is set to undefined . (Didn’t understand? Refer the code below extracted from MDN).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;strong&gt;That if a function is called as a method of an object, its this is set to the object the method is called on even though it is in strict mode.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://gist.github.com/Omkaragrawal/7865bcdcd50b6c4bfcd45b053fb518ca" rel="noopener noreferrer"&gt;Gist&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AHnF5-2WUDRKicYJSkTZxXg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AHnF5-2WUDRKicYJSkTZxXg.png" alt="Value of this in strict mode is undefined"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7.Value of this can be custom set when calling the function by using .apply(), .call() . &lt;br&gt;
(Didn’t understand? Refer the codes below)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;strong&gt;That in non–strict mode, with call and apply, if the value passed as this is not an object, an attempt will be made to convert it to an object using the internal toObject operation. So if the value passed is a primitive like 7 or ‘foo’, it will be converted to an Object using the related constructor, number 7 is converted by new Number(7) and the string ‘foo’ by new String(‘foo’).&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://gist.github.com/Omkaragrawal/c6d8de530cb9d5011938bb3cd07cafb3" rel="noopener noreferrer"&gt;&lt;strong&gt;Gist&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3568%2F1%2AK2yTcdSSQo6A7WO-i3zFzA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3568%2F1%2AK2yTcdSSQo6A7WO-i3zFzA.png" alt="Example 1 of .call() and .apply()"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2120%2F1%2AHGTGmAs0NeUsKNkFPXiM-A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2120%2F1%2AHGTGmAs0NeUsKNkFPXiM-A.png" alt="Example 2 of .call() and .apply()"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;8.Using .bind() creates a new function which which has same body and scope as the function it is called upon but the value of this is permanently set to the value of parameter of .bind() and then returns the new function. (One more point in the example below, look for examples below)&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://gist.github.com/Omkaragrawal/35b2aea42e351f87923bb679aaa3436d" rel="noopener noreferrer"&gt;&lt;strong&gt;Gist&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AGVO52G8gysSSPV-sqYbCNw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AGVO52G8gysSSPV-sqYbCNw.png" alt="Example of .bind()"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;9.A function used as getter or setter has its this bound to the object from which the property is being set or gotten. (Didn’t understand? refer to the code below from MDN).&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://gist.github.com/Omkaragrawal/cd6b694aecfaec330dd050e01235ed61" rel="noopener noreferrer"&gt;&lt;strong&gt;Gist&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2100%2F1%2AiMYsRPObNbwhu5LygesqIA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2100%2F1%2AiMYsRPObNbwhu5LygesqIA.png" alt="Example of Object.defineProperty()"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  TLDR: The value of “ this “ of function is set to the the context in which the function is called in. That is if a function is called as a method of an object, its “ this “ is set to the object the method is called on.
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ARZsaKhjXYlBahqTQq0isXw.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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2ARZsaKhjXYlBahqTQq0isXw.gif" alt="Working of the solution code"&gt;&lt;/a&gt;&lt;em&gt;Working of the solution code&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3644%2F1%2AMi8BvGDK_umJxSJZElmw3w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3644%2F1%2AMi8BvGDK_umJxSJZElmw3w.png" alt="Solution for the problem"&gt;&lt;/a&gt;&lt;em&gt;Solution for the problem&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is where I end my article. Any suggestions are most welcome.&lt;/p&gt;

&lt;p&gt;Contact me on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://bit.ly/omkaragrawal-linkedin" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://bit.ly/omkaragrawal-github" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://bit.ly/omkaragrawal-twitter" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://bit.ly/omkaragrawal-facebook" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>functional</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
