<?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: SURAJITSHAW</title>
    <description>The latest articles on DEV Community by SURAJITSHAW (@surajitshaw).</description>
    <link>https://dev.to/surajitshaw</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%2F735301%2F68cf2124-c794-4222-b58e-c05e1752a769.png</url>
      <title>DEV Community: SURAJITSHAW</title>
      <link>https://dev.to/surajitshaw</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/surajitshaw"/>
    <language>en</language>
    <item>
      <title>Reference VS. Primitive Values</title>
      <dc:creator>SURAJITSHAW</dc:creator>
      <pubDate>Fri, 21 Jan 2022 17:02:47 +0000</pubDate>
      <link>https://dev.to/surajitshaw/reference-vs-primitive-values-3n1h</link>
      <guid>https://dev.to/surajitshaw/reference-vs-primitive-values-3n1h</guid>
      <description>&lt;p&gt;&lt;strong&gt;Do you know there is two types of values in JavaScript ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&amp;gt; primitive values and reference values.&lt;/em&gt;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You maybe know that but do you know what are the difference between those 2 types ? How they stores in memory ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&amp;gt; if your answer is "no", not to worry, we are gonna discuss all this in details.&lt;/em&gt;  Just keep reading this blog 😊&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EP5EYu3p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9lq7q8r29r3kvz6ahlly.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EP5EYu3p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9lq7q8r29r3kvz6ahlly.png" alt="Image description" width="880" height="576"&gt;&lt;/a&gt;&lt;br&gt;
In ECMAScript 2015  we were introduced more two primitive data types. There's a saying &lt;code&gt;Everything in JavaScript is a Object&lt;/code&gt;, well almost everything except Primitive data types. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Now let's see how Primitive values differs from Reference values :&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MmRDDbL7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qfdriuk1dxsz8rcip3nj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MmRDDbL7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qfdriuk1dxsz8rcip3nj.png" alt="Image description" width="880" height="1155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you come from different languages ( e.g : C/C#, Java ) you probably know the concept of  'PASS BY VALUE' &amp;amp; 'PASS BY REFERENCE'. &lt;/p&gt;

&lt;p&gt;In simple terms...&lt;/p&gt;

&lt;p&gt;"&lt;strong&gt;Passing by value&lt;/strong&gt;"_ means that you pass the actual value of the variable into the function. So, in your example, it would pass the value 9._&lt;br&gt;
"&lt;strong&gt;Passing by reference&lt;/strong&gt;" &lt;em&gt;means that you pass the variable itself into the function (not just the value). So, in your example, it would pass an integer object with the value of 9.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jEN3v-fk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ju9bxh26gfyh0tw6mtnv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jEN3v-fk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ju9bxh26gfyh0tw6mtnv.png" alt="Image description" width="880" height="626"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In JavaScript you can consider Primitives with Pass by value and Reference values with Passing by reference. Also in code snippet you can clearly show when change the value of obj1, changes are reflects to copied obj2 as well. But in case of primitives you just pass a copy of original value so after when you change the original it doesn't affect the copied value.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Primitives&lt;/strong&gt; : We store the actual value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt; : Here variable store the address where the data in heap memory is located. This doesn't store the actual value like primitives, instead a pointer or a reference to data. &lt;/p&gt;




&lt;p&gt;&lt;u&gt;&lt;strong&gt;SUMMARY&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;PRIMITIVES VALUES :&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Value types are immutable.&lt;/li&gt;
&lt;li&gt;value types are compared by value.&lt;/li&gt;
&lt;li&gt;value types are copied by value. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;REFERANCE VALUES :&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reference types are mutable.&lt;/li&gt;
&lt;li&gt;reference values are copied by address to memory or reference. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you find this blog helpful make sure to give it 💛, also can follow me on &lt;a href="https://twitter.com/SURAJIT__SHAW"&gt;Twitter&lt;/a&gt; for more helpful resources and tips.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>JS Event Loop and Call Stack</title>
      <dc:creator>SURAJITSHAW</dc:creator>
      <pubDate>Thu, 20 Jan 2022 05:35:02 +0000</pubDate>
      <link>https://dev.to/surajitshaw/js-event-loop-and-call-stack-360h</link>
      <guid>https://dev.to/surajitshaw/js-event-loop-and-call-stack-360h</guid>
      <description>&lt;p&gt;Hello everyone 👋, I hope you are doing great.&lt;/p&gt;

&lt;p&gt;So, today you are going to learn An Overview of what JavaScript event loop and call stack are, and how JavaScript work visually.&lt;/p&gt;

&lt;p&gt;Many JavaScript developers don't know how JavaScript works. If you are new to JavaScript, then this article will help to learn how JavaScript works.&lt;/p&gt;

&lt;p&gt;⚙️ &lt;strong&gt;JavaScript Engine&lt;/strong&gt;&lt;br&gt;
The JavaScript engine is a program that executes your JavaScript code. A popular example of a JavaScript engine is Google's V8 engine.&lt;/p&gt;

&lt;p&gt;⚙️ &lt;strong&gt;V8 Engine&lt;/strong&gt;&lt;br&gt;
The V8 engine is an open-source, high-performance JavaScript and Web Assembly engine written in C++. The V8 engine is used inside Google Chrome, Node.js, and electron, among others.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event Loop&lt;/strong&gt; : &lt;em&gt;The event loop is the secret behind JavaScript’s asynchronous programming. JS executes all operations on a single thread, but using a few smart data structures, it gives us the illusion of multi-threading. Let’s take a look at what happens on the back-end.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Call Stack&lt;/strong&gt; : &lt;em&gt;The call stack is responsible for keeping track of all the operations in line to be executed. Whenever a function is finished, it is popped from the stack.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zkazqq7fx5sykqecl06.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%2F1zkazqq7fx5sykqecl06.png" alt="Image of call stack and it's function push and pop"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event Queue&lt;/strong&gt; : &lt;em&gt;The event queue is responsible for sending new functions to the track for processing. It follows the queue data structure to maintain the correct sequence in which all operations should be sent for execution.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajsp1lwhphv7t2dhvdaq.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%2Fajsp1lwhphv7t2dhvdaq.png" alt="Image of a queue"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whenever an async function is called, it is sent to a browser API. These are APIs built into the browser. Based on the command received from the call stack, the API starts its own single-threaded operation.&lt;/p&gt;

&lt;p&gt;An example of this is the setTimeout method. When a setTimeout operation is processed in the stack, it is sent to the corresponding API which waits till the specified time to send this operation back in for processing.&lt;/p&gt;

&lt;p&gt;Where does it send the operation? The event queue. Hence, we have a cyclic system for running async operations in JavaScript. The language itself is single-threaded, but the browser APIs act as separate threads.&lt;/p&gt;

&lt;p&gt;The event loop facilitates this process; it constantly checks whether or not the call stack is empty. If it is empty, new functions are added from the event queue. If it is not, then the current function call is processed.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffuzsf8e6r06p3v1mmxtw.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%2Ffuzsf8e6r06p3v1mmxtw.png" alt="whole diagram of JavaScript environment "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading! My name is Surajit Shaw; I love to share my learning with others. You can follow me on &lt;a href="https://twitter.com/SURAJIT__SHAW" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; if you’d like to learn about web development and JavaScript.&lt;/p&gt;

&lt;p&gt;Here's a link where I explain how JavaScript work much briefly &lt;a href="https://twitter.com/SURAJIT__SHAW/status/1484022930833313792?s=20" rel="noopener noreferrer"&gt;Understanding of JavaScript Function Executions.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Starting With Tailwind CSS</title>
      <dc:creator>SURAJITSHAW</dc:creator>
      <pubDate>Fri, 19 Nov 2021 08:58:57 +0000</pubDate>
      <link>https://dev.to/surajitshaw/how-to-setup-tailwind-css-for-you-project-1l7l</link>
      <guid>https://dev.to/surajitshaw/how-to-setup-tailwind-css-for-you-project-1l7l</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is Tailwind CSS?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CSS framework made up of utility classes&lt;/li&gt;
&lt;li&gt;Much lower-level than Bootstrap, Materialize etc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Using Tailwind CSS&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Tailwind CSS using npm (node package manager)&lt;/li&gt;
&lt;li&gt;You'll need node.js installed in your computer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;To check if node is already installed or not, open up your terminal and write below command&lt;/em&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;if you get some sort of number like that &lt;strong&gt;v14.1.0&lt;/strong&gt; you are good to go otherwise you can just download &lt;strong&gt;Node&lt;/strong&gt; from here&lt;/em&gt; : &lt;a href="https://nodejs.org/en/download/"&gt;Install Node.JS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Tailwind Works&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--028PHxF7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6u5le0ournfgo7kjfco.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--028PHxF7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6u5le0ournfgo7kjfco.jpg" alt="How Tailwind Works" width="880" height="574"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;When we use tailwind we create a src file where we import all tailwind core styles or functionality and also we can write our own CSS styles then we use Tailwind to process it and output into Vanilla CSS file, and can link it to our &lt;strong&gt;index.html&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now let's start with Tailwind CSS :&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Install Tailwind via npm&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;open up your terminal and run below commands&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install tailwindcss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Add Tailwind to your CSS&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Create a CSS file if you don’t already have one, and use the &lt;a class="mentioned-user" href="https://dev.to/tailwind"&gt;@tailwind&lt;/a&gt;
 directive to inject Tailwind’s base, components, and utilities styles&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tailwind base;
@tailwind components;
@tailwind utilities;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;That's all for the initial setup now you can use tailwindcss classes in your index.html to style it, before that you had to run this command in terminal&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tailwindcss build src/style.css -o public/style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Or you can add a script for this and also for production in package.json&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s2C0wZCD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fabqp7jn83ba6a55v6x0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s2C0wZCD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fabqp7jn83ba6a55v6x0.jpg" alt="build and production scripts" width="880" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you have any sorts of problem with the process you can checkout official documentation&lt;/em&gt; &lt;a href="https://tailwindcss.com/docs/"&gt;Tailwind Docs&lt;/a&gt;,&lt;br&gt;
&lt;em&gt;Or you can comment down below I'll try my best to resolve it.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>tailwindcss</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
