<?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: Gaurav Sharma</title>
    <description>The latest articles on DEV Community by Gaurav Sharma (@gsharma010).</description>
    <link>https://dev.to/gsharma010</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%2F542419%2F67f55096-3c7d-46bf-a99c-1deaf1509485.jpg</url>
      <title>DEV Community: Gaurav Sharma</title>
      <link>https://dev.to/gsharma010</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gsharma010"/>
    <language>en</language>
    <item>
      <title>Data Types in JavaScript</title>
      <dc:creator>Gaurav Sharma</dc:creator>
      <pubDate>Sat, 23 Apr 2022 08:49:22 +0000</pubDate>
      <link>https://dev.to/gsharma010/data-types-in-javascript-12g6</link>
      <guid>https://dev.to/gsharma010/data-types-in-javascript-12g6</guid>
      <description>&lt;h2&gt;
  
  
  What is a Data Type
&lt;/h2&gt;

&lt;p&gt;In computer science and computer programming, a data type or simply type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support basic data types of integer numbers, floating-point numbers, characters and Booleans.&lt;/p&gt;

&lt;p&gt;🌟In simple terms data type clearly means what type of data it is. A number, A character, A String etc&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌟There are 7 primitive data types in JavaScript&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1️⃣ Number&lt;br&gt;
2️⃣ String&lt;br&gt;
3️⃣ Boolean&lt;br&gt;
4️⃣ undefined &lt;br&gt;
5️⃣ null&lt;br&gt;
6️⃣ symbol&lt;br&gt;
7️⃣ big int&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌟Number Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡 Number's are always so-called floating point number which means that they always have decimals. Even if we don't see them or don't define them. &lt;/p&gt;

&lt;p&gt;🟡Example the value 23 is same as 23.0. But they are both simply the number data type.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhu2zfrx0y5nyjtt9dhm2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhu2zfrx0y5nyjtt9dhm2.png" alt="Image description" width="600" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌟String Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡String data type are simply a sequence of character and so they're just used for text and always put in quotes (no mater if double or single.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffw08j7s7wf2cwp82goxh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffw08j7s7wf2cwp82goxh.png" alt="Image description" width="600" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌟Boolean Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡The Boolean data type is essentially a logical type that can only take one of the logical value true or false. We use bool value to take decisions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foesbooxcncdlvdx0baiy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foesbooxcncdlvdx0baiy.png" alt="Image description" width="600" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewyxrrohgxbrb2hqpoki.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewyxrrohgxbrb2hqpoki.png" alt="Image description" width="600" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌟Undefined Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡 So first undefined is the value taken by a variable that is not yet defined. And the variable that not yet defined is simply just a variable that we declare but without assigning a value. Undefined is basically an empty value&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F35mz3o9326qak1u255mj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F35mz3o9326qak1u255mj.png" alt="Image description" width="600" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌟Null Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡Null is pretty similar because it also means empty value. We will discuss more about this in future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌟Symbol Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡 Symbol data type was introduced in ES 2015. This data type is not very useful for us. It's simply defines a value that is unique and cannot be changed&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌟Big int&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡Starting in ES 2020 there is also Big Int. Which is for integers that are too large to be represented by the number type. It's another type for numbers.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>What is JavaScript ?</title>
      <dc:creator>Gaurav Sharma</dc:creator>
      <pubDate>Fri, 15 Apr 2022 19:02:09 +0000</pubDate>
      <link>https://dev.to/gsharma010/what-is-javascript--5b69</link>
      <guid>https://dev.to/gsharma010/what-is-javascript--5b69</guid>
      <description>&lt;h2&gt;
  
  
  What is JavaScript ?
&lt;/h2&gt;

&lt;p&gt;JavaScript is a high-level prototype-based object oriented Multiparadigm, interpreted or just in time compilated dynamic, single Treaded, garbage collected programming language with first-class functions and a non-blocking event loop concurrency module. &lt;/p&gt;

&lt;p&gt;🤯&lt;strong&gt;Don't Worry Let's break above definition into points.&lt;/strong&gt;👇&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High-level&lt;/li&gt;
&lt;li&gt;Garbage-Collection&lt;/li&gt;
&lt;li&gt;Interpreted or just in time compiled&lt;/li&gt;
&lt;li&gt;Multi-paradigm&lt;/li&gt;
&lt;li&gt;Prototype-based object-oriented&lt;/li&gt;
&lt;li&gt;First class functions&lt;/li&gt;
&lt;li&gt;Dynamic&lt;/li&gt;
&lt;li&gt;Single-Threaded&lt;/li&gt;
&lt;li&gt;Non-blocking event loop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🌟Now Let's discuss each point in detail.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. JavaScript is High-Level&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡Every program that runs on our computer needs some hardware resources such as memory and the cpu to do its work.&lt;/p&gt;

&lt;p&gt;🟡There are low level languages like C where we have to manually manage these resources.&lt;/p&gt;

&lt;p&gt;On the other side we have high level languages like python and JavaScript where we do not have to manage resources at all.&lt;/p&gt;

&lt;p&gt;🟡 Because these languages have so called abstractions that take all of the work away from us.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. JavaScript has Garbage-Collection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡 It is basically an algorithm inside the JavaScript engine  that removes old, unused objects from the computer memory&lt;/p&gt;

&lt;p&gt;🟡 JavaScript cleans our memory from time to time so that we don't have to do it manually in our code&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. JavaScript is interpreted or Just-in-time compiled&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡 Computer processor ultimately understands 0 or 1 every single program needs to be written in binary language which is also called machine code.&lt;/p&gt;

&lt;p&gt;🟡 That is not practical to right that's why we write human-readable code.&lt;/p&gt;

&lt;p&gt;Like JavaScript which is an abstraction over machine code.&lt;/p&gt;

&lt;p&gt;🟡But this code eventually needs to be translated to machine code and that step can be either compiling or interpreting.&lt;/p&gt;

&lt;p&gt;🟡 Above step is necessary in every single programming language.&lt;/p&gt;

&lt;p&gt;🟡 Because no one write machine code manually. IN case of JavaScript This happens inside the JavaScript engine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. JavaScript is Multi-paradigm language&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡 In programming a paradigm is an approach overall mindset of structuring our code. Which will ultimately direct the coding style and technique in a project that uses a certain paradigm.&lt;/p&gt;

&lt;p&gt;🟡 Some popular programming paradigm are:-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Procedural Programming&lt;/li&gt;
&lt;li&gt;Object-oriented programming (OOP)&lt;/li&gt;
&lt;li&gt;Functional Programming&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. JavaScript has prototype-based, object-oriented approach.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡 All most everything in JavaScript is an object except of primitive values.&lt;/p&gt;

&lt;p&gt;🟡 But arrays, for example are just object.&lt;/p&gt;

&lt;p&gt;🟡 Now, have you ever wondered why we can create an array and then use the push method on it&lt;/p&gt;

&lt;p&gt;🟡 It's because of "prototypal inheritance". Basically we create arrays from an array blueprint which is like template and this is called the prototype.&lt;/p&gt;

&lt;p&gt;👉 I will create a separate thread 🧵 on prototypal inheritance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. JavaScript is a language with first class function&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡In a language with first-class functions, functions are simply treated as variables. We can pass them into other functions, and return them from functions.&lt;/p&gt;

&lt;p&gt;🟡Which means functions are treated as regular variables&lt;/p&gt;

&lt;p&gt;🟡So, we can pass functions into other functions and we can even return functions from functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. JavaScript is Dynamic&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡JavaScript is a dynamic language which means dynamically-typed language&lt;/p&gt;

&lt;p&gt;🟡In JavaScript we don't assign data types to variables, instead they only become known when the JavaScript engine executes our code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdug3m6lbd2sskrgj1xi5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdug3m6lbd2sskrgj1xi5.jpg" alt="Image description" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. JavaScript is Single-Threaded&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡 Before know what is single threaded we need to know about the "Concurrency Model"&lt;/p&gt;

&lt;p&gt;🟡 Well "Concurrency Model" is a fancy term that means how the JavaScript engine handles multiple tasks happening at the same time.&lt;/p&gt;

&lt;p&gt;🟡 JavaScript itself runs in one single-thread which means it can only do on thing at a time and therefore we need a way of handling multiple things at the same time.&lt;/p&gt;

&lt;p&gt;🟡By the way in computing a thread is like a set of instructions that is executed in computer's CPU&lt;/p&gt;

&lt;p&gt;🟡 So basically, the thread is where our code is actually executed in a machine's processor.&lt;/p&gt;

&lt;p&gt;🟡But what if there is a long running task like fetching data from a remote server.&lt;/p&gt;

&lt;p&gt;🟡Well it sounds like that would block the single thread where the code is running right.&lt;/p&gt;

&lt;p&gt;🟡 But we don't want that. what we want is &lt;/p&gt;

&lt;p&gt;🌟 &lt;strong&gt;Non-blocking behavior and how do we achieve that. Well by using a so-called event loop. The event loop takes long-running tasks, executes in the background and put's them back in the main thread&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🟡 This is in a nutshell JavaScript's non-blocking event loop concurrency model with a single thread&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
