<?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: Suryansh Chopra</title>
    <description>The latest articles on DEV Community by Suryansh Chopra (@suryanshchopra).</description>
    <link>https://dev.to/suryanshchopra</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%2F670582%2F04491e75-e8fd-431f-8ab9-b6adeae5bcbb.png</url>
      <title>DEV Community: Suryansh Chopra</title>
      <link>https://dev.to/suryanshchopra</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/suryanshchopra"/>
    <language>en</language>
    <item>
      <title>Stocks: Profit or loss indicator</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Fri, 13 Aug 2021 23:00:08 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/stocks-profit-or-loss-indicator-12fp</link>
      <guid>https://dev.to/suryanshchopra/stocks-profit-or-loss-indicator-12fp</guid>
      <description>&lt;p&gt;&lt;a href="https://unsplash.com/photos/DfjJMVhwH_8" rel="noopener noreferrer"&gt;Cover photo&lt;/a&gt; by @austindistel show some ❤️ to &lt;a href="https://unsplash.com/@austindistel" rel="noopener noreferrer"&gt;creator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's been a while since I uploaded a blog. The project I did recently was to make a Profit or loss indicator for Stocks.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/tPAA7rJI5PI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This is a project I created by using Vanilla JS, It inputs 3 parameters&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stock symbol&lt;/li&gt;
&lt;li&gt;Initial investing amount&lt;/li&gt;
&lt;li&gt;Stock quantity&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Based on these 3 parameters, it will give output of the current price and and shows profit and loss according to it.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&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%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/SuryanshChopra" rel="noopener noreferrer"&gt;
        SuryanshChopra
      &lt;/a&gt; / &lt;a href="https://github.com/SuryanshChopra/Profit-or-loss-Indicator" rel="noopener noreferrer"&gt;
        Profit-or-loss-Indicator
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Stocks: profit or loss indicator
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Now I wanna show you how you can build this awesome website.
&lt;/h2&gt;

&lt;p&gt;Nothing to be feared, I got you&lt;/p&gt;

&lt;p&gt;Remember what you need in the project, 3 input parameters &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A stock symbol&lt;/li&gt;
&lt;li&gt;A initial investing amount&lt;/li&gt;
&lt;li&gt;A stock quantity&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Start by including these 3 things in your &lt;code&gt;index.html&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;form&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;label&amp;gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"input1"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Enter the stock symbol"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; Enter the stock symbol&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;                       
&lt;span class="nt"&gt;&amp;lt;label&amp;gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"input2"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Enter Cost price of Stock"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; Purchase Price&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;       
&lt;span class="nt"&gt;&amp;lt;label&amp;gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"input3"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Enter stock Quantity"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; Stock Quantity &lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;                       
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Check&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"output0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"output"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Done with these, now move to JavaScript section, In &lt;code&gt;app.js&lt;/code&gt; return the form elements and add a event listener on "submit" button&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forms&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;input1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#input1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;input2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#input2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;input3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#input3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.output&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;output0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.output0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;submit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;checkHandler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;checkHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;CP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;Qty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;isNaN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;isNaN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Qty&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;isNaN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;SP&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;CP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;Qty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Qty&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;SP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;SP&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;Qty&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;SP&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;

            &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;SP&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
                &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;loss&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;SP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;Qty&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lossPer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(((&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;SP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You lost ${lossPer}%. Your total loss is $${loss}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

            &lt;span class="p"&gt;}&lt;/span&gt;

            &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;profit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;SP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;Qty&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;profitPer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(((&lt;/span&gt;&lt;span class="nx"&gt;SP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;CP&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You gained ${profitPer}%. Your total profit is $${profit}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Please enter values greater than 0 (only numbers are allowed in above fields&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Please enter values greater than 0 (only numbers are allowed in above fields&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="p"&gt;})&lt;/span&gt;


    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You must be like "WOAH dude where the hell is this SP coming from" &lt;/p&gt;

&lt;p&gt;Relax man we gonna get this value from the API, That's right the Stock symbol user has entered, its closing price will become our SP. It is included here just to let you know our logic is correct.&lt;/p&gt;

&lt;p&gt;So Now the problem arises where do I get this API that's gonna get my closing price. Chill man  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/9QpWnH4AWv6xKvSX7T/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/9QpWnH4AWv6xKvSX7T/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, we are gonna use Tiingo API, or use any of your favourite API, some use AlphaVantage, I never used it , so I cannot tell the difference.&lt;/p&gt;

&lt;p&gt;Anyways, make a account on &lt;a href="https://api.tiingo.com/" rel="noopener noreferrer"&gt;api.tiingo.com&lt;/a&gt;. It's like 5 minute job then navigate to &lt;a href="https://api.tiingo.com/account/api/token" rel="noopener noreferrer"&gt;api.tiingo.com/account/api/token&lt;/a&gt;. Here is your API key, Don't give it to anyone, keep it safe.&lt;/p&gt;

&lt;p&gt;Now usually how Tiingo api works is by calling the stock symbol of a particular stock. For example:&lt;br&gt;
&lt;code&gt;https://api.tiingo.com/tiingo/daily/AAPL/prices&lt;/code&gt; - Here I have use Apple Stock symbol &lt;code&gt;AAPL&lt;/code&gt;(this is gonna become our input1). It won't work right now because it is not associated with your token.&lt;/p&gt;

&lt;p&gt;Input this link in on Postman app. if you don't have it, install it. Add 2 headers&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Content-type: application/json
Authorization: Token &amp;lt;your token&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click on send button. You'll get a nice JSON type file looking like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"adjClose"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;148.89&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"adjHigh"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;149.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"adjLow"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;145.84&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"adjOpen"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;146.19&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"adjVolume"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;73779113&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"close"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;148.89&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2021-08-12T00:00:00+00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"divCash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;149.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"low"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;145.84&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"open"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;146.19&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"splitFactor"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"volume"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;73779113&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click on the code snippet &amp;lt;/&amp;gt; icon and get the link in JavaScript-Fetch. Copy the entire code and paste it in &lt;code&gt;app.js&lt;/code&gt; inside the CheckHandler function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;myHeaders&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Headers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;myHeaders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;myHeaders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Authorization&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Token &amp;lt;your token&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// your token doesn't go in &amp;lt;&amp;gt;. It is a way to explain you&lt;/span&gt;
&lt;span class="nx"&gt;myHeaders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Cookie&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sessionid=&amp;lt;your session id&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;requestOptions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;myHeaders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;follow&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.tiingo.com/tiingo/daily/AAPL/prices&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;requestOptions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On running you must be getting a CORS error, it is normal nothing to be panick about. It is use to restrict HTTP and HTTPS requests made from scripts to resources in a different origin for security reasons, mainly to protect the user's data and prevent attacks that would compromise the app.&lt;/p&gt;

&lt;p&gt;There are many ways to resolve this error, we are gonna do this by using a simple way. You can use any method you want. just go to &lt;code&gt;https://cors-anywhere.herokuapp.com/&lt;/code&gt; and "request temporary access" Also add a single line &lt;code&gt;https://cors-anywhere.herokuapp.com/&lt;/code&gt; before your api link like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://cors-anywhere.herokuapp.com/https://api.tiingo.com/tiingo/daily/AAPL/prices&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;requestOptions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's fix this snippet first we don't need entire JSON file which is showing in our console right now. We are only interested in close price of the stock. Instead of &lt;code&gt;.then(result =&amp;gt; console.log(result))&lt;/code&gt; do this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;translatedText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;adjClose&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;SP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;translatedText&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="nx"&gt;output0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Current price for this stock is: ${SP}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Onto our second problem, the current snippet will always give value for the AAPL prices. To change this add in the initial lines of &lt;code&gt;app.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;serverURL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://cors-anywhere.herokuapp.com/https://api.tiingo.com/tiingo/daily/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getTranslationURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;serverURL&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/prices&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;SP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and instead of using &lt;code&gt;fetch("https://cors-anywhere.herokuapp.com/https://api.tiingo.com/tiingo/daily/AAPL/prices", requestOptions)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;do this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;getTranslationURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;inputText&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;requestOptions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations!! you are done with the application&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/g9582DNuQppxC/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/g9582DNuQppxC/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Do this part only if you want to upload your project on to github
&lt;/h2&gt;

&lt;p&gt;Now, that we've made our application there is one problem still remaining. Our code is sitting right there with our API key in it. We certainly can't push this onto github. so, we are gonna do what any man should do in this situation&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We should not push our code onto github &lt;br&gt;
 &lt;/p&gt;
&lt;center&gt;- Suryansh Chopra (2021)&lt;/center&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  That's a joke That's a joke...
&lt;/h4&gt;

&lt;p&gt;Back to the problem, create a &lt;code&gt;config.js&lt;/code&gt; file,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;TOKEN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;your token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;//your token must be inside ''.&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add these lines inside &lt;code&gt;app.js&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;TOKEN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//rest code&lt;/span&gt;

&lt;span class="nx"&gt;myHeaders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Authorization&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Token &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create a &lt;code&gt;.gitignore&lt;/code&gt; file and add&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;config.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;inside it.&lt;/p&gt;

&lt;p&gt;Push the code and you have successfully uploaded the code and kept your API key safe.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/zDpYQooxkwXkAWMxRK/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/zDpYQooxkwXkAWMxRK/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Day 8 Training: Birthday-lucky react app</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Fri, 30 Jul 2021 19:40:30 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/day-8-training-birthday-lucky-react-app-34f1</link>
      <guid>https://dev.to/suryanshchopra/day-8-training-birthday-lucky-react-app-34f1</guid>
      <description>&lt;p&gt;Yesterday was my Day 8 Training at Ryaz. The objective was to make a Is-your-birthday-lucky app in react.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take user's complete birthday&lt;/li&gt;
&lt;li&gt;And his/her lucky number.&lt;/li&gt;
&lt;li&gt;Now, find out if sum of digits of birthday is divisible by the lucky number.&lt;/li&gt;
&lt;li&gt;Show the result to user with some graphics.&lt;/li&gt;
&lt;li&gt;Create this as a website, put a privacy notice. Say that you're not storing data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/QPZRRbo2HsmUAHGFzz/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/QPZRRbo2HsmUAHGFzz/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was very time tasking project not because of logic but because of designing. After a day on working on this I had to take a small help from Material UI regarding the alert boxes and Icons. Rest I had to dig up the CSS from internet. In short I'm totally exhausted by this project :)&lt;/p&gt;

&lt;p&gt;The Live project is up at &lt;a href="https://7vsin.csb.app/?#mainSection"&gt;code sandbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Code for this project is updated on my &lt;a href="https://github.com/SuryanshChopra/is-your-birthday-lucky"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AND THAT'S ALL!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>Day 7 of Training: Make a Cash Register app</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Wed, 28 Jul 2021 16:48:20 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/day-7-of-training-make-a-cash-register-app-30ib</link>
      <guid>https://dev.to/suryanshchopra/day-7-of-training-make-a-cash-register-app-30ib</guid>
      <description>&lt;p&gt;Today was my Day 7 of training in Ryaz. The objective was to make a Cash register App.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your program has currencies of Rs. 1, 5, 10, 20, 100, 500, 2000.&lt;/li&gt;
&lt;li&gt;Your user enters a bill amount say Rs. 243.&lt;/li&gt;
&lt;li&gt;Your user then enters a cash given say Rs. 2000.&lt;/li&gt;
&lt;li&gt;Now, help the user by telling how can he/she return the change to the customer with minimum number of notes?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J7uJ3oN2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wwjgrzqyiv2q70v1964.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J7uJ3oN2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wwjgrzqyiv2q70v1964.PNG" alt="Capture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've made this project in vanilla js. It was a good project to brush up the basics. The logic was to traverse the remaining change through the array. Most of my time has gone to designing and error handling.&lt;/p&gt;

&lt;p&gt;The live project is on my &lt;a href="https://xlkqn.csb.app/"&gt;code sandbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code for this project is updated on my &lt;a href="https://github.com/SuryanshChopra/Cash-register-app"&gt;Github repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AAAND THAT'S ALL!!&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Day 6 of Training: Assignment React Js</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Tue, 27 Jul 2021 19:48:15 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/day-6-of-training-assignment-react-js-10ig</link>
      <guid>https://dev.to/suryanshchopra/day-6-of-training-assignment-react-js-10ig</guid>
      <description>&lt;p&gt;Today was my day 6 of Training in Ryaz. Apart from the Emoji-Interpreter. I had to make a recommendation app divided by different genres. So I decided to make a Anime recommendation app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nmwxosT_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3s24r1x58iwlj8f34oyv.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nmwxosT_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3s24r1x58iwlj8f34oyv.PNG" alt="Capture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is kinda similar to Emoji-Interpreter app, so not many problems occur during this project.&lt;/p&gt;

&lt;p&gt;Live project is up on &lt;a href="https://us9e4.csb.app/"&gt;sandbox&lt;/a&gt;. Make sure to visit it guys!!, Also comment down below what you guys think that I need to watch that is totally banger.&lt;/p&gt;

&lt;p&gt;Code for this project is updated on my &lt;a href="https://github.com/SuryanshChopra/my-anime-recommendation"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AND THAT'S ALL!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>Day 6 of Training: React Js</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Tue, 27 Jul 2021 13:12:04 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/day-6-of-training-react-js-45no</link>
      <guid>https://dev.to/suryanshchopra/day-6-of-training-react-js-45no</guid>
      <description>&lt;p&gt;Yesterday was my day 6 training at Ryaz. I learnt about the basics of React Js by making a Emoji Interpreter app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--snOdGYot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5dgsp8dpeow8spty8h1y.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--snOdGYot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5dgsp8dpeow8spty8h1y.PNG" alt="Capture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The live project is up now at &lt;a href="https://8u69b.csb.app/"&gt;sandbox&lt;/a&gt;. Make sure to visit it. &lt;/p&gt;

&lt;p&gt;It was really fun making this app and I learnt a lot about React during this project. Although the main app work is complete, I will be improving its styling and update the emoji database later on.&lt;/p&gt;

&lt;p&gt;Code for the project is present at my &lt;a href="https://github.com/SuryanshChopra/Emoji-Interpreter"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do you know:&lt;br&gt;
&lt;a href="https://emojipedia.org/"&gt;emojipedia&lt;/a&gt; - It is website known as "Encyclopedia of emoji". It shows emojis with their meaning, I find it quite funny. All emoji fans should at least visit this website once. &lt;/p&gt;

&lt;p&gt;AND THAT'S ALL! See you tomorrow&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>Day 5 of Training: Node js</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Mon, 26 Jul 2021 13:49:06 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/day-5-of-training-node-js-k65</link>
      <guid>https://dev.to/suryanshchopra/day-5-of-training-node-js-k65</guid>
      <description>&lt;p&gt;Yesterday was my day 5 of training in Ryaz. I learnt about basics of Node js by making a CLI quiz game.&lt;br&gt;
I have used for loops, functions, arrays and dictionary in my project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lHwHWEHn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1svt34xadhnh5gpmrrnu.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lHwHWEHn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1svt34xadhnh5gpmrrnu.PNG" alt="Capture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do you know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/readline-sync"&gt;readlineSync&lt;/a&gt;: It is a npm package that lets you have a conversation with the user via a console(TTY). A super handy tool if you want to make a complete CLI project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.npmjs.com/package/chalk"&gt;chalk&lt;/a&gt;: It is a npm package that lets you color inside a terminal. Pretty awesome tool, definitely going to use in my next CLI project.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Are You a Marvel fan? Drop by to check if you are true fan by giving a small quiz&lt;/p&gt;

&lt;p&gt;&lt;a href="https://replit.com/@SuryanshChopra/Marvel-Quiz?embed=1&amp;amp;output=1"&gt;Marvel quiz&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/SuryanshChopra/JavaScript-CLI"&gt;Code&lt;/a&gt; &lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Day 4 of Training: Vanilla JavaScript</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Fri, 23 Jul 2021 09:03:56 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/day-4-of-training-vanilla-javascript-3n48</link>
      <guid>https://dev.to/suryanshchopra/day-4-of-training-vanilla-javascript-3n48</guid>
      <description>&lt;p&gt;Yesterday was 4 day of my training with Ryaz. The task provided was to understand the basics of Vanilla and successfully implement it into the project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SY6Uflrm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8jtpedzlx2lotzrsst9.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SY6Uflrm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8jtpedzlx2lotzrsst9.PNG" alt="Capture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;During this project I got know about &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Event Listeners&lt;/li&gt;
&lt;li&gt;Reading from Input&lt;/li&gt;
&lt;li&gt;Writing to DOM&lt;/li&gt;
&lt;li&gt;Arrays &amp;amp; objects&lt;/li&gt;
&lt;li&gt;Processing data on user actions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Personal expense app handles your personal expense. You can add and delete the expenses as you want. The styling for this app was done using bootstrap. I've not added much for now.&lt;/p&gt;

&lt;p&gt;Github repository - &lt;a href="https://github.com/SuryanshChopra/Personal-Expense"&gt;Personal Expense&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Day 3 of Training: To do list using Vanilla JavaScript</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Wed, 21 Jul 2021 10:41:42 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/day-3-of-training-to-do-list-using-vanilla-javascript-4a4i</link>
      <guid>https://dev.to/suryanshchopra/day-3-of-training-to-do-list-using-vanilla-javascript-4a4i</guid>
      <description>&lt;p&gt;Today was the day 3rd of my training with Ryaz.&lt;br&gt;
Task was focused on creating a simple to do list with Vanilla JavaScript in order to understand better the concept of Java DOM.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dXojg14W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12yk2bqwne04v0vyn09t.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dXojg14W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12yk2bqwne04v0vyn09t.PNG" alt="Capture"&gt;&lt;/a&gt;&lt;br&gt;
While working on the project I revised my previous concept regarding DOM. Also learnt some new features in this project.&lt;/p&gt;

&lt;p&gt;I've added .addEventListeners to add task, to mark complete task(line-through) and to remove the task from the list(double-click).&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Day 2 of Training: JavaScript in browser</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Wed, 21 Jul 2021 05:44:41 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/day-2-of-training-javascript-in-browser-581o</link>
      <guid>https://dev.to/suryanshchopra/day-2-of-training-javascript-in-browser-581o</guid>
      <description>&lt;p&gt;Yesterday was my day 2 of training in Ryaz.&lt;br&gt;
The task was basically divided into different parts like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Attaching events to HTML elements&lt;/li&gt;
&lt;li&gt;Taking user input in browser&lt;/li&gt;
&lt;li&gt;Showing output in browser&lt;/li&gt;
&lt;li&gt;Making network calls to get relevant data.&lt;/li&gt;
&lt;li&gt;Error handling network calls&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I learnt many things from yesterday's lesson like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;document.querySelector() - It returns the first element that matches a specified CSS selector(s) in the document.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;addEventListener() - This method attaches an event handler to the specified element.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fetch() -  It is useful in fetching resources across the internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do you Know: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://funtranslations.com/"&gt;funtranslations&lt;/a&gt; - This website provides API translations to the users for free. There are tons of API's you can go through like "minion", "yoda", "Dothraki" and many more. It is more fun working with a API that reference meme culture. Only and most irritating downside is that it only gives 5 API calls per hour or two. &lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>DAY 1 Of Training: HTML AND CSS</title>
      <dc:creator>Suryansh Chopra</dc:creator>
      <pubDate>Tue, 20 Jul 2021 10:31:46 +0000</pubDate>
      <link>https://dev.to/suryanshchopra/day-1-of-training-html-and-css-106a</link>
      <guid>https://dev.to/suryanshchopra/day-1-of-training-html-and-css-106a</guid>
      <description>&lt;p&gt;Yesterday was my first day of Training under Ryaz. I am very helpful to the community as well as the mentors who have guided me with every step.&lt;/p&gt;

&lt;p&gt;Yesterday task was to follow the tutorials of component libraries HTML5 and CSS3 and to make a website. Component Libraries that I explored were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Typography&lt;/li&gt;
&lt;li&gt;Containers&lt;/li&gt;
&lt;li&gt;Links&lt;/li&gt;
&lt;li&gt;Lists&lt;/li&gt;
&lt;li&gt;Navbar&lt;/li&gt;
&lt;li&gt;Header&lt;/li&gt;
&lt;li&gt;Section&lt;/li&gt;
&lt;li&gt;Footer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ICBu5DHQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/va8pkayma28f74bvnkq4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ICBu5DHQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/va8pkayma28f74bvnkq4.png" alt="screenshot-127.0.0.1_5500-2021.07.20-15_53_08"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;During the task I have encountered many new things I would like to share:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.undraw.co/illustrations"&gt;Undraw&lt;/a&gt; - A good website always follow some kind of pattern, design that will match the theme of your website. Undraw offers various illustrations to beautify the website. For example - illustrations like "programming" or "gaming" or what-not, Everything is provided for free. It also comes with color selector to match the theme of your project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tailwindcss.com/docs/customizing-colors"&gt;Tailwind CSS colors&lt;/a&gt; - It offers variations of colors to users so as to match with the theme of the project. A user can also customize the colors as per there need.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://fonts.google.com"&gt;Google fonts&lt;/a&gt; - As I have already mentioned, A good website always follow some kind of pattern, design to beautify your website. But not only fonts or illustrations alone can do that work. A great part of making a good website is to focus on Fonts. Selecting the perfect font is a difficult job. Google fonts helps the user to find there perfect font and also offers various font styles and widths to go by. A user can simply selects the font and can import these fonts into the project.&lt;/p&gt;

&lt;p&gt;These are some new things that I have learnt and I am definitely visiting it again in future.&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
    </item>
  </channel>
</rss>
