<?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: Pooja Gupta</title>
    <description>The latest articles on DEV Community by Pooja Gupta (@poojagupta).</description>
    <link>https://dev.to/poojagupta</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%2F576850%2F0e815b9f-3399-47c0-b408-91927b48c36a.jpg</url>
      <title>DEV Community: Pooja Gupta</title>
      <link>https://dev.to/poojagupta</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/poojagupta"/>
    <language>en</language>
    <item>
      <title>Getting started with Node JS</title>
      <dc:creator>Pooja Gupta</dc:creator>
      <pubDate>Tue, 16 Mar 2021 15:27:13 +0000</pubDate>
      <link>https://dev.to/poojagupta/getting-started-with-node-js-5f4l</link>
      <guid>https://dev.to/poojagupta/getting-started-with-node-js-5f4l</guid>
      <description>&lt;p&gt;Hey folks! I just started learning node JS and thought to share with all of you who are new to node JS and wanted to learn node JS.&lt;br&gt;
so we are gonna see little insights of node JS and after that we will write our first code in node JS.&lt;/p&gt;
&lt;h2&gt;
  
  
  So What is Node JS?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node.js is a cross-platform JavaScript runtime environment that allows developers to build server-side and network applications with JavaScript.&lt;/li&gt;
&lt;li&gt;NPM is a package manager which comes bundled with node JS which helps in downloading packages into a node_modules folder.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can use npm init command to initialize your project which will ask basic information about your project and creates one file package.json which will have all information you provide.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So package.json file is face of your project which will contain all the information about your project as well as all those dependencies needed for your project with their version name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Their are a lot of frameworks available which will ease our work while writing our code like express, sails, Hapi, Koa etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;But first let we use simple Node JS without any framework to understand it in depth.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In your folder create index.js and do npm init after that write this code in index.js file and do node index.js from the command line from the same path where your index file exists.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const http = require("http");
const port = 8000;

function requestHandler(request, response) {
  console.log("Request received.");
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Welcome to node.js World");
  response.end();
}

const server = http.createServer(requestHandler);
server.listen(port, function(err){
    if(err){
        console.log(err);
        return;
    }

    console.log("Server is up and running:", port);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In this case, on each and every url, you found “welcome to node.js world”. Now we will send different response, according to requested url.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const http = require("http");
const port = 8000;

function requestHandler(req, res) {
    if (req.url == "/") {
        res.writeHead(200, { "Content-Type": "text/html" });
        res.end("Welcome to the homepage!");
    }

    // About page
    else if (req.url == "/contact") {
        res.writeHead(200, { "Content-Type": "text/html" });
        res.end("Welcome to the contact page!");
    }

    // 404'd!
    else {
        res.writeHead(404, { "Content-Type": "text/plain" });
        res.end("404 error! File not found.");
    }
}

const server = http.createServer(requestHandler);
server.listen(port, function(err){
    if(err){
        console.log(err);
        return;
    }

    console.log("Server is up and running:", port);
});
console.log("Server has started.");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we track requested url and respectively show that content on that url, and handle 404 condition in all other cases. &lt;br&gt;
I hope this article helps you getting started with node JS, don't forget to tell me in comment section how much you liked this post and in case any query reach me out !&lt;br&gt;
Happy Coding!&lt;/p&gt;

</description>
      <category>node</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>An ultimate guide to JavaScript</title>
      <dc:creator>Pooja Gupta</dc:creator>
      <pubDate>Wed, 10 Feb 2021 05:43:05 +0000</pubDate>
      <link>https://dev.to/poojagupta/an-ultimate-guide-to-javascript-2dhh</link>
      <guid>https://dev.to/poojagupta/an-ultimate-guide-to-javascript-2dhh</guid>
      <description>&lt;p&gt;&lt;strong&gt;ABOUT&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;This is all about brushing up your skills in JavaScript if you are a person who is working around JavaScript and wanted to brush up your skillset with its amazing power or you are a person who is searching one place where you can call up your concepts, this blog is for you.&lt;br&gt;
Listing down all amazing facts which we need to know when start writing code in JavaScript, here we go-&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;1.It is Developed by brandon eich in 1995, for adding interactivity in Netscape, its first name was mocha then livescript then JavaScript.&lt;/p&gt;

&lt;p&gt;2.After JavaScript Microsoft also came up with JScript which was the reverse engineered version of JavaScript.&lt;/p&gt;

&lt;p&gt;3.This causes pain for developers to design pages that work well on IE and Netscape than JavaScript was standardized by ECMA international in 1997 and ECMASCRIPT or ES.&lt;/p&gt;

&lt;p&gt;4.JS is dynamically typed or loosely types so we do not have to declare the data type, it has 6 primitive values and 1 object i.e., number, string, Boolean, null, undefined and ES6 added symbol, Everything else is an Object type.&lt;/p&gt;

&lt;p&gt;5.IF you will not add semicolon JS will add it but in some cases it will leads to unexpected results so just to play safe we should add it&lt;/p&gt;

&lt;p&gt;6.In JS if you created a variable and not assigned any value then it will be undefined not a garbage value, if we don’t know the value then we can assign null that means we don't have a value right now.&lt;/p&gt;

&lt;p&gt;7.typeOf(null) will not be a null, it will be an object which is a bug in JavaScript.&lt;/p&gt;

&lt;p&gt;8.Since JavaScript is a weakly-typed language, values can also be converted between different types automatically, and it is called implicit type coercion. It usually happens when you apply operators to values of different types, and if a developer expresses the intention to convert between types by writing the appropriate code, like Number(value), it’s called explicit type coercion.&lt;/p&gt;

&lt;p&gt;9.If you have made a function with arguments and providing fewer Arguments will be undefined and greater will be ignored.&lt;/p&gt;

&lt;p&gt;10.Hoisting is JavaScript's default behavior of moving all declarations(functions and variables) to the top of the current scope.&lt;br&gt;
Hoisting does happen in case of const but its different in case of const you can not access const variable until and unless at runtime there declaration and definition is reached.&lt;/p&gt;

&lt;p&gt;11.As we all know we can access object properties using square or dot notation but There are certain situations where we can use square notation to access objects and rather than dot notation.&lt;br&gt;
Like in case of invalid key name or key name starting with number.&lt;/p&gt;

&lt;p&gt;12.In JavaScript arrays are objects it means you can add key value pair where keys will be indexes and value will hold property and one more fact that all the indexes if they are numbers, JavaScript automatically converts it into the string for you, you can access values like arr[0] or arr[‘a’].&lt;/p&gt;

&lt;p&gt;13.Another fun fact is that array length is calculated as the highest index number+1 and you can add any dynamic property to it anytime and all the undefined indexes of the array are like empty places, not garbage like other languages.&lt;/p&gt;

&lt;p&gt;14.You can write JavaScript code within the script tag just makes sure that in JS code if you are trying to access elements the those elements are there on the page because if we trying to access those elements before they have been rendered then we will get null in that case, which is why we placed the script tag towards the end of the HTML documents so that everything you need for that code is present.&lt;/p&gt;

&lt;p&gt;15.We can use IIFE(Immediately invoked function expression)  is a JavaScript function that runs as soon as it is defined, it can be used as a solution if we don’t want to clash global variables or functions in two files with the same name.&lt;/p&gt;

&lt;p&gt;16.Closures is a concept of a combination of function and the lexical environment of which the function was created.&lt;br&gt;
or we can say closure is a function that remembers its outer variables and can access them, and all functions in JavaScript are closures.&lt;/p&gt;

&lt;p&gt;17.The purpose of "use strict" is to indicate that the code should be executed in "strict mode", the normal, non-strict mode of JavaScript is sometimes referred to as sloppy mode.&lt;/p&gt;

&lt;p&gt;18.There are 4 ways to invoke a function in JavaScript&lt;br&gt;
i)invoking a function as a function as we always do.&lt;br&gt;
ii) Invoking a function as a method means creating an object and function inside it and calling it using an object.&lt;br&gt;
iii) Invoking a function with a function constructor.&lt;br&gt;
iv) Calling a function via call and apply.&lt;/p&gt;

&lt;p&gt;19.Logical operators in JavaScript, unlike operators in other programming languages, do not return true or false. They always return one of the operands.&lt;/p&gt;

&lt;p&gt;20.Scope chain-JavaScript engine also uses Scope to find variables, if the JavaScript engine does not find the variable in local scope, it tries to check for the variable in the outer scope. If the variable does not exist in the outer scope, it tries to find the variable in the global scope.&lt;/p&gt;

&lt;p&gt;21.Functions that are used as an argument to another function are called callback functions.&lt;/p&gt;

&lt;p&gt;22.In JavaScript, functions are treated as first-class citizens, they can be used as an argument of another function, can be returned by another function and can be used as a property of an object.&lt;/p&gt;

&lt;p&gt;23.The event.preventDefault() method stops the default action of an element from happening.&lt;/p&gt;

&lt;p&gt;24.In JavaScript, there is a special constructor function known as Object() is used to create and initialize an object. The return value of the Object() constructor is assigned to a variable. The variable contains a reference to the new object. We need an object constructor to create an object “type” that can be used multiple times without redefining the object every time.&lt;/p&gt;

&lt;p&gt;25.Hoisting as a concept which exists in JavaScript functions, classes are special functions and hoisting will not work in this case.&lt;/p&gt;

&lt;p&gt;These were 25 facts which I feel we all should know as developers about JavaScript.&lt;/p&gt;

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