<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mahendar Kolpula on Medium]]></title>
        <description><![CDATA[Stories by Mahendar Kolpula on Medium]]></description>
        <link>https://medium.com/@kolpulamahendar?source=rss-4cfafb05be34------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*P1ckZzTzCk3Fct5n.</url>
            <title>Stories by Mahendar Kolpula on Medium</title>
            <link>https://medium.com/@kolpulamahendar?source=rss-4cfafb05be34------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 15:22:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kolpulamahendar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[JSON]]></title>
            <link>https://medium.com/@kolpulamahendar/json-30c029e1d59d?source=rss-4cfafb05be34------2</link>
            <guid isPermaLink="false">https://medium.com/p/30c029e1d59d</guid>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Mahendar Kolpula]]></dc:creator>
            <pubDate>Wed, 21 Oct 2020 13:42:39 GMT</pubDate>
            <atom:updated>2020-10-21T13:42:39.011Z</atom:updated>
            <content:encoded><![CDATA[<p>JSON stands for <strong>J</strong>ava<strong>S</strong>cript <strong>O</strong>bject <strong>N</strong>otation,it is a lightweight format for storing and transporting data,it is often used when data is sent from a server to a web page and it is “self-describing” and easy to understand.</p><p><strong>JSON Synatax :</strong></p><ul><li>Data is in key/value pairs</li><li>Data is separated by commas</li><li>Curly braces hold objects</li><li>Square brackets hold arrays</li></ul><p>Every key/value pair consists of a field in double quotes.</p><p><strong>Sample Json Data:</strong></p><p>Let say we have a Shopping Application and with this data.</p><blockquote>{<br>“products:[<br> {“name”:”Iphone X”, “price”:10000, “id”:1},<br> {“name”:”Macbook”, “price”:20000, “id”:2},<br>]<br>}</blockquote><p><strong>Conversion from JSON to JavaScript Object:</strong></p><p>There is an JavaScript built-in function <strong>JSON.parse()</strong> to convert the string into a JavaScript object:</p><p>var jsonProducts = “{<br>“products:[<br> {“name”:”Iphone X”, “price”:10000, “id”:1},<br> {“name”:”Macbook”, “price”:20000, “id”:2},<br>]<br>}”</p><p>var jsProducts = JSON.parse(jsonProducts);</p><p>Now we can access each key using dot notation.</p><p>jsProducts.products[0] // “name”:”Iphone X”, “price”:10000, “id”:1},</p><p>jsProducts.products[1] // {“name”:”Macbook”, “price”:20000, “id”:2},</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30c029e1d59d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Variable Scope in Javascript]]></title>
            <link>https://medium.com/@kolpulamahendar/variable-scope-in-javascript-384d35982b7f?source=rss-4cfafb05be34------2</link>
            <guid isPermaLink="false">https://medium.com/p/384d35982b7f</guid>
            <category><![CDATA[var]]></category>
            <category><![CDATA[variables]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mahendar Kolpula]]></dc:creator>
            <pubDate>Wed, 21 Oct 2020 13:18:08 GMT</pubDate>
            <atom:updated>2020-10-21T13:18:08.229Z</atom:updated>
            <content:encoded><![CDATA[<p>We can declare variables in 3 different keywords in Javascript, but before this we have to know scope in Javascript.</p><p>There are two scopes:</p><ol><li><strong>Global Scope: </strong>We can access this scope of variables anywhere.</li><li><strong>Local Scope: </strong>We can access this scope of variables within a function/loop where it declared.</li></ol><h4>In the way we have let’s discuss variables keywords:</h4><p><strong>let: </strong>let keyword has local scope, which is limited to a function or a loop.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*Eh9hunnrUexP5F2dw-FRFQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*ABaQXZwh8hQlEE_QKydQ6Q.png" /></figure><p><strong>var: </strong>var keyword variabled has global scope, so we can access it anywhere. Best practice is declaring this variable out of the functions and loops.</p><p><strong>const: </strong>const keyword has global scope, Once we assign it is permanant and we can’t re-assign.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*DrUsyNUcFADwMy30rZRN-A.png" /></figure><h3>Detailed View of Variables:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EFa8Yy2sL27liAIjbU4qRg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=384d35982b7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP request in JavaScript]]></title>
            <link>https://medium.com/@kolpulamahendar/http-request-in-javascript-b9fd528feca2?source=rss-4cfafb05be34------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9fd528feca2</guid>
            <category><![CDATA[axios]]></category>
            <category><![CDATA[http-request]]></category>
            <dc:creator><![CDATA[Mahendar Kolpula]]></dc:creator>
            <pubDate>Wed, 21 Oct 2020 12:55:34 GMT</pubDate>
            <atom:updated>2020-10-21T12:55:34.119Z</atom:updated>
            <content:encoded><![CDATA[<p>JavaScript has great modules and methods to make HTTP requests that can be used to send or receive data from a server side resource. In this article, we are going to look at a few popular ways to make HTTP requests in JavaScript.</p><h3>Ajax</h3><p>Ajax is the traditional way to make an asynchronous HTTP request. Data can be sent using the HTTP POST method and received using the HTTP GET method. Let’s take a look and make a GET request. I’ll be using JSONPlaceholder, a free online REST API for developers that returns random data in JSON format.</p><p>To make an HTTP call in Ajax, you need to initialize a new XMLHttpRequest() method, specify the URL endpoint and HTTP method (in this case GET). Finally, we use the open() method to tie the HTTP method and URL endpoint together and call the send() method to fire off the request.</p><p>We log the HTTP response to the console by using the XMLHTTPRequest.onreadystatechange property which contains the event handler to be called when the readystatechanged event is fired.</p><h3>fetch</h3><p>fetch is a new powerful web API that lets you make asynchronous requests. In fact, fetch is one of the best and my favorite way to make an HTTP request. It returns a “Promise” which is one of the great features of ES6.<em> </em>If you are not familiar with ES6, you can read about it in <a href="https://medium.freecodecamp.org/write-less-do-more-with-javascript-es6-5fd4a8e50ee2">this</a> article. Promises allow us to handle the asynchronous request in a smarter way. Let’s take a look at how fetch technically works.</p><p>The fetch function takes one required parameter: the endpoint URL. It also has other optional parameters as in the example below:</p><p>As you can see, fetch has many advantages for making HTTP requests. You can learn more about it <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch">here</a>. Additionally, within fetch there are other modules and plugins that allow us to send and receive a request to and from the server side, such as <a href="https://github.com/axios/axios">axios</a>.</p><h3>Axios</h3><p>Axios is an open source library for making HTTP requests and provides many great features. Let’s have a look at how it works.</p><h3>Usage:</h3><p>First, you’d need to include Axios. There are two ways to include Axios in your project.</p><p>First, you can use npm:</p><pre>npm install axios --save</pre><p>Then you’d need to import it</p><pre>import axios from &#39;axios&#39;</pre><p>Second, you can include axios using a CDN.</p><pre>&lt;script src=&quot;https://unpkg.com/axios/dist/axios.min.js&quot;&gt;&lt;/script&gt;</pre><h3>Making a Request with axios:</h3><p>With Axios you can use GET and POST to retrieve and post data from the server.</p><h3>GET:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>axios takes one required parameter, and can take a second optional parameter too. This takes some data as a simple query.</p><h3>POST:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p><a href="https://github.com/axios/axios">Axios</a> returns a “Promise.” If you’re familiar with promises, you probably know that a promise can execute multiple requests. You can do the same thing with axios and run multiple requests at the same time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*Fq2gqLpyqpBHwR2m.png" /></figure><p>Axios supports many other methods and options. You can explore them <a href="https://github.com/axios/axios">here</a>.</p><h3>Angular HttpClient</h3><p>Angular has its own HTTP module that works with Angular apps. It uses the <a href="http://reactivex.io/rxjs/">RxJS</a> library to handle asynchronous requests and provides many options to perform the HTTP requests.</p><h3>Wrapping Up</h3><p>We’ve just covered the most popular ways to make an HTTP call request in JavaScript</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9fd528feca2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>