<?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: Gitanshu  Choudhary</title>
    <description>The latest articles on DEV Community by Gitanshu  Choudhary (@gitanshu_choudhary).</description>
    <link>https://dev.to/gitanshu_choudhary</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%2F311785%2Fb9411757-d680-4d3a-8ca9-c24d3d173d5c.png</url>
      <title>DEV Community: Gitanshu  Choudhary</title>
      <link>https://dev.to/gitanshu_choudhary</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gitanshu_choudhary"/>
    <language>en</language>
    <item>
      <title>The “Book Cricket” Game Built via Modern JavaScript &amp; HTML</title>
      <dc:creator>Gitanshu  Choudhary</dc:creator>
      <pubDate>Mon, 20 Jan 2020 18:17:41 +0000</pubDate>
      <link>https://dev.to/gitanshu_choudhary/the-book-cricket-game-built-via-modern-javascript-html-4bhf</link>
      <guid>https://dev.to/gitanshu_choudhary/the-book-cricket-game-built-via-modern-javascript-html-4bhf</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Hi, I am back again with another Tech Story on “DEV” based on Modern JavaScript &amp;amp; a little bit of HTML.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We will be building a Game called “Book Cricket”, which I used to play in my School Days. For those who are not aware of this Game, I will give you all a brief overview of it.&lt;/p&gt;

&lt;p&gt;“Book Cricket” is played among 2 players &amp;amp; as the second half of the name ‘Cricket’ suggests that the Player with more runs wins the Game.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How We used To Play in ‘School Days’ ?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We used to select a ‘Book’ ( Thicker the Better !) &amp;amp; ‘Total Number of Wickets’ for each player.&lt;/li&gt;
&lt;li&gt;Each Player on his/her Turn used to open the Book to a ‘Random Page Number’.&lt;/li&gt;
&lt;li&gt;Then we used to note the last digit of that ‘Randomly Selected Page Number’. For example, If I opened the book randomly on to Page Number ‘102’ so my Runs for that particular turn would be calculated as ‘2 Runs’.&lt;/li&gt;
&lt;li&gt;After noting down the Runs scored, Book is ‘Closed’ and is ‘Opened’ again to a ‘Random Page Number’ &amp;amp; follows the Steps ‘2 &amp;amp; 3’.&lt;/li&gt;
&lt;li&gt;In Case the Player gets a ‘Page Number’, with its Last Digit as ‘0’ ( for example 120 or 40 ), then the Player lose 1 Wicket.&lt;/li&gt;
&lt;li&gt;In every turn Runs are ‘Added’ onto the Runs scored by the Player in his/her ‘Previous’ turns. This Continues till the Player losses all his/her ‘Wickets’ or ‘Runs’ scored by that Player surpasses the Runs scored by other Player.&lt;/li&gt;
&lt;li&gt;‘Sole Purpose’ is to ‘Win’ the Game by scoring ‘More Runs’ than your Opponent before loosing all your ‘Wickets’.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I know, to some it might sound familiar &amp;amp; to some a bit confusing. But we should look at the ‘Big Picture’ that is the Logical Code to build this Game.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So let’s begin with the Coding Part Now !!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We will decode our Game in 2 Parts :&lt;/p&gt;

&lt;h2&gt;
  
  
  First Part for HTML ,
&lt;/h2&gt;

&lt;p&gt;We will build the ‘User Interface’ of our Game using basic HTML components such as :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;‘H2’ &amp;amp; ‘Label’ tags for headings&lt;/li&gt;
&lt;li&gt;2 ‘Input’ fields for entering Information regarding ‘Book Size’ &amp;amp; ‘Total Wickets’.&lt;/li&gt;
&lt;li&gt;3 ‘Button’ tags for ‘Player 1’, ‘Player 2’ &amp;amp; ‘New Match’ with Event Handlers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GcL-mLEF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/q85cpfoky9qaqrdu0wtk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GcL-mLEF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/q85cpfoky9qaqrdu0wtk.png" alt="index.html" width="683" height="461"&gt;&lt;/a&gt;&lt;/p&gt;
 index.html 



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2qDzwl2w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/26jmgrksbit34pdtuk9n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2qDzwl2w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/26jmgrksbit34pdtuk9n.png" alt="Output : index.htm" width="554" height="170"&gt;&lt;/a&gt;&lt;/p&gt;
 Output : index.html 



&lt;h2&gt;
  
  
  Second Part for JavaScript,
&lt;/h2&gt;

&lt;p&gt;We will be coding “mainJS.js” in sub-parts according to their functionalities individually :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;First&lt;/strong&gt; sub-part, we will be initializing our ‘Global Variables’.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D1FOVqwg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/l3vba6s2kay14nftejgh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D1FOVqwg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/l3vba6s2kay14nftejgh.png" alt="Global Variables Initialization" width="282" height="102"&gt;&lt;/a&gt;&lt;/p&gt;
 Global Variables Initialization 



&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;Second&lt;/strong&gt; sub-part, playerWin() function is defined which would compare the final scores of both the players to Decide the Winner.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fqMiO2L4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mme39udupu5z422dzmus.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fqMiO2L4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mme39udupu5z422dzmus.png" alt="playerWin() function" width="643" height="224"&gt;&lt;/a&gt;&lt;/p&gt;
 playerWin() function 



&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;Third&lt;/strong&gt; sub-part, we will define an ‘Event Listener’ for Button linked to ‘Player 1’. This ‘Event Listener’ will fire two functions. First function is ‘calPlayerScore()’ which will calculate the Runs scored by Player for every Turn, using ‘Math Functions’ of JavaScript. Second function is ‘playerTurn1()’ which will keep Track of the Runs scored and Wickets left for ‘Player 1’.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y_KI6NUl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/34yqxvu4wl2qs9zqbhgw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y_KI6NUl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/34yqxvu4wl2qs9zqbhgw.png" alt="Event Listener for ‘Player 1’ button" width="728" height="604"&gt;&lt;/a&gt;&lt;/p&gt;
 Event Listener for ‘Player 1’ button 



&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;Fourth&lt;/strong&gt; sub-part, we will define an ‘Event Listener’ for Button linked to ‘Player 2’. This ‘Event Listener’ will fire two functions. First function is ‘calPlayerScore()’ which will calculate the Runs scored by Player for every Turn, using ‘Math Functions’ of JavaScript. Second function is ‘playerTurn2()’ which will keep Track of the Runs scored and Wickets left for ‘Player 2’.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RqptV0jK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3e9z9i21kbkrjzazcve0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RqptV0jK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3e9z9i21kbkrjzazcve0.png" alt="Event Listener for ‘Player 2’ button" width="619" height="617"&gt;&lt;/a&gt;&lt;/p&gt;
 Event Listener for ‘Player 2’ button 



&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;Fifth&lt;/strong&gt; sub-part, we will define an ‘Event Listener’ for ‘New Match’ Button. This ‘Event Listener’ will Clear The Console and will enable the ‘Player 1’ &amp;amp; ‘Player 2’ buttons for the New Match. It will also reset the Global Variables to their Default Values.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xji-3mk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ao1d75xscsylnaxpd331.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xji-3mk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ao1d75xscsylnaxpd331.png" alt="Event Listener for ‘New Match’ button" width="636" height="205"&gt;&lt;/a&gt;&lt;/p&gt;
 Event Listener for ‘New Match’ button 



&lt;h2&gt;
  
  
  Finally, its time to see the Code in Action below :
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QGYrgfbf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6xmyn6z169dp6gjzvbxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QGYrgfbf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6xmyn6z169dp6gjzvbxl.png" alt="Player 1 Score" width="741" height="619"&gt;&lt;/a&gt;&lt;/p&gt;
 Player 1 Score 



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MrcsPbN6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kryf1jq2pf9ncrtok79i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MrcsPbN6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kryf1jq2pf9ncrtok79i.png" alt="Player 2 Score" width="615" height="615"&gt;&lt;/a&gt;&lt;/p&gt;
 Player 2 Score 



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jlEBsiXQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/pli20qaut1uabm7ou0e1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jlEBsiXQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/pli20qaut1uabm7ou0e1.png" alt="New Match" width="597" height="455"&gt;&lt;/a&gt;&lt;/p&gt;
 New Match 



&lt;h3&gt;
  
  
  Attaching below the code via public GitHub gist link.
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;






&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;If you liked my efforts, do encourage this post via Feedbacks &amp;amp; Comments.&lt;br&gt;
I appreciate the support.&lt;br&gt;
Thank You !&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;





&lt;div class="ltag__user ltag__user__id__311785"&gt;
  
    .ltag__user__id__311785 .follow-action-button {
      background-color: #000000 !important;
      color: #ffffff !important;
      border-color: #000000 !important;
    }
  
    &lt;a href="/gitanshu_choudhary" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CCtcAAXH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--Hb0VYHKj--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/311785/b9411757-d680-4d3a-8ca9-c24d3d173d5c.png" alt="gitanshu_choudhary image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/gitanshu_choudhary"&gt;Gitanshu  Choudhary&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/gitanshu_choudhary"&gt;Mulesoft API Development&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;





</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Simple &amp; Sober "Wallet Tracker" in Modern JavaScript</title>
      <dc:creator>Gitanshu  Choudhary</dc:creator>
      <pubDate>Sun, 12 Jan 2020 15:53:51 +0000</pubDate>
      <link>https://dev.to/gitanshu_choudhary/simple-sober-wallet-tracker-in-modern-javascript-16c4</link>
      <guid>https://dev.to/gitanshu_choudhary/simple-sober-wallet-tracker-in-modern-javascript-16c4</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Hi, my name is Gitanshu Choudhary and being a JavaScript enthusiast I am penning down my second Tech Story on "DEV".&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this story, we will be creating a Modern JavaScript application called "Wallet Tracker" with its interface implemented on Cmder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Info-Pinch :&lt;/strong&gt; Cmder pronounced "Commander" is a pre-configured software package that provides you with an awesome terminal emulator, and best shell you'll ever have on Windows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Our Application&lt;/strong&gt; will be based on Simple yet Key JavaScript elements such as :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Functions / Methods&lt;/li&gt;
&lt;li&gt;Arrays&lt;/li&gt;
&lt;li&gt;Objects&lt;/li&gt;
&lt;li&gt;Built-In Array Functions&lt;/li&gt;
&lt;li&gt;Loops&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;"Wallet Tracker"&lt;/strong&gt; will consist of Three Major methods for implementing its functionality :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First method will be used to add the flow of Income in the user's Wallet.&lt;/li&gt;
&lt;li&gt;Second method will be used to add the flow of Expense out of the user's Wallet.&lt;/li&gt;
&lt;li&gt;Third method will be used to calculate the Balance left in the user's Wallet, And display the Lists of all Income &amp;amp; Expense transactions along with their Descriptions/Sources.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  "One Man Army",
&lt;/h1&gt;

&lt;p&gt;In our application the whole logical code is stored in One Single Object called "myWallet".&lt;br&gt;
From initializing the Basic Key-Value Pairs to creating Logical Methods, everything is embedded in a single object.&lt;/p&gt;
&lt;h1&gt;
  
  
  3 Key-Value Pairs,
&lt;/h1&gt;

&lt;p&gt;We will be creating 3 Key-Value pairs to initialize our application.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First key is named as "name" which will contain the name of the Wallet holder.&lt;/li&gt;
&lt;li&gt;Second Key is "incomes" which act as an Array to store Objects with properties as "amount" &amp;amp; "source".&lt;/li&gt;
&lt;li&gt;Third Key is "expenses" which act as an Array to store Objects with properties as "amount" &amp;amp; "source".&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rCbMxK3i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ypsh7xf44s6by57t0t11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rCbMxK3i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ypsh7xf44s6by57t0t11.png" alt="3 Key-Value Pairs" width="321" height="119"&gt;&lt;/a&gt;&lt;/p&gt;
 3 Key-Value Pairs 


&lt;h1&gt;
  
  
  3 Dynamic Methods,
&lt;/h1&gt;

&lt;p&gt;We will be creating 3 Methods which will Dynamically process the 3 Key-Value pairs which we defined above.&lt;/p&gt;
&lt;h2&gt;
  
  
  First Method,
&lt;/h2&gt;

&lt;p&gt;We will be creating is called addIncome(amount, source), where "amount" will store the cash in-flow while the "source" stores the description regarding this deposit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--isS1xkFc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/iem1kbdqyt11w1pjqiq3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--isS1xkFc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/iem1kbdqyt11w1pjqiq3.png" alt="addIncome() method" width="365" height="130"&gt;&lt;/a&gt;&lt;/p&gt;
 addIncome() method 


&lt;h2&gt;
  
  
  Second Method,
&lt;/h2&gt;

&lt;p&gt;We will be creating is called addExpense(amount, source), where "amount" will store the cash out-flow while the "source" stores the description regarding this withdrawal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7_1cPRWV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/bs48xjsrv6ewxnxre8ba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7_1cPRWV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/bs48xjsrv6ewxnxre8ba.png" alt="addExpense() method" width="364" height="130"&gt;&lt;/a&gt;&lt;/p&gt;
 addExpense() method 


&lt;h2&gt;
  
  
  Third Method,
&lt;/h2&gt;

&lt;p&gt;We will be creating is called walletReceipt(), it takes no arguments. In this method we will be calculating following things :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Total Expenses :&lt;/strong&gt; Using a forEach() loop, we will be calculating the total Expenses spent by the user &amp;amp; will also be printing a list of all the Withdrawals along with their descriptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Total Incomes :&lt;/strong&gt; Using a forEach() loop, we will be calculating the total Incomes earned by the user &amp;amp; will also be printing a list of all the Deposits along with their descriptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Balance :&lt;/strong&gt; Using the Return Value of above loops, we will be calculating the Balance value left in the Wallet. We will be printing a Final Statement showcasing the "name" of the user with the final values of his/her Expense, Income and Balance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SlLmdpN6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/xq7u0qyr3s6vvvx4ef3b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SlLmdpN6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/xq7u0qyr3s6vvvx4ef3b.png" alt="walletReceipt() method" width="689" height="390"&gt;&lt;/a&gt;&lt;/p&gt;
 walletReceipt() method 


&lt;h1&gt;
  
  
  Finally,
&lt;/h1&gt;

&lt;p&gt;We will be calling these methods to showcase the functionality of our application by Calling Statements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AwP1brII--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/563dfhi8n5r80qsk9xqo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AwP1brII--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/563dfhi8n5r80qsk9xqo.png" alt="Calling Statements" width="435" height="157"&gt;&lt;/a&gt;&lt;/p&gt;
 Calling Statements 



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt; of our application will be shown as :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TGHMwACt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jpiyhm9zluz09znsge6b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TGHMwACt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jpiyhm9zluz09znsge6b.png" alt="Output" width="580" height="245"&gt;&lt;/a&gt;&lt;/p&gt;
 Output 



&lt;p&gt;At the end, we have successfully created our "Wallet Tracker" application using simple yet major Elements of Pure Modern Javascript.&lt;/p&gt;
&lt;h3&gt;
  
  
  Attaching below the code via public GitHub gist link.
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;If you liked my efforts, do encourage this post via Feedbacks &amp;amp; Comments.&lt;br&gt;
I appreciate the support.&lt;br&gt;
Thank You !&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;





&lt;div class="ltag__user ltag__user__id__311785"&gt;
  
    .ltag__user__id__311785 .follow-action-button {
      background-color: #000000 !important;
      color: #ffffff !important;
      border-color: #000000 !important;
    }
  
    &lt;a href="/gitanshu_choudhary" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CCtcAAXH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--Hb0VYHKj--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/311785/b9411757-d680-4d3a-8ca9-c24d3d173d5c.png" alt="gitanshu_choudhary image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/gitanshu_choudhary"&gt;Gitanshu  Choudhary&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/gitanshu_choudhary"&gt;Mulesoft API Development&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;





</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>CRUD Operations in Modern JavaScript</title>
      <dc:creator>Gitanshu  Choudhary</dc:creator>
      <pubDate>Sat, 11 Jan 2020 19:31:54 +0000</pubDate>
      <link>https://dev.to/gitanshu_choudhary/crud-operations-in-modern-javascript-379e</link>
      <guid>https://dev.to/gitanshu_choudhary/crud-operations-in-modern-javascript-379e</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Hi, My name is Gitanshu Choudhary, an enthusiastic JavaScript learner.&lt;br&gt;
Firstly, I want to thank all the readers for giving their time to go through my 'First DEV Story'. And a big shout-out to DEV for providing such a great innovative platform.&lt;br&gt;
I am a newbie to this big world of JavaScript, And my first real progress is performing CRUD operations in JavaScript.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  'CRUD'...
&lt;/h1&gt;

&lt;p&gt;Crud operations are like the first steps for every programmer who yearns at learning a programming language.&lt;br&gt;
To be a hardcore developer, we have to strengthen up our foundations &amp;amp; 'CRUD' are at the core of every programming language.&lt;br&gt;
We will be coding a 'Note Taking Application' in pure Modern JavaScript to showcase the working of CRUD operations.&lt;br&gt;
Now let us define 'CRUD' operations with respect to our "Note Taking Application". This application stores a note with a "Title"as a String datatype and "Status" as a Boolean datatype. Each note will be stored as an object and and all the notes in the application will be stored together as an Array of Objects.&lt;br&gt;
Firstly, we will create an Array of Objects called "notesList" which will contain notes in the form of objects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1-pyd0wy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/aczt9kwo8o530yeorq0e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1-pyd0wy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/aczt9kwo8o530yeorq0e.png" alt="notesList Array of Objects" width="299" height="430"&gt;&lt;/a&gt;&lt;/p&gt;
 notesList Array of Objects 


&lt;h1&gt;
  
  
  C for Create...
&lt;/h1&gt;

&lt;p&gt;Here, we will be creating a function called "addNote(title, status)" which will add a new note to the application. Arguments of this function require a Title and a Status for the new note. Title will contain the string name, And status will contain either a true or false value, where true depicts that the status of note is complete and false depicts its incomplete status.&lt;br&gt;
In addNote() function, we will be using push() method to add new Note Object in the Array of Objects called "notesList".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a64iMYkg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/p3uabw5zp4icybyg4bbd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a64iMYkg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/p3uabw5zp4icybyg4bbd.png" alt="addNote() function" width="557" height="141"&gt;&lt;/a&gt;&lt;/p&gt;
 addNote() function 



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CJNdCitY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ubz7ndl5v3ncjdwpcywe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CJNdCitY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ubz7ndl5v3ncjdwpcywe.png" alt="Output : addNote() function" width="458" height="132"&gt;&lt;/a&gt;&lt;/p&gt;
 Output : addNote() function 


&lt;h1&gt;
  
  
  R for Read...
&lt;/h1&gt;

&lt;p&gt;Here, we will be creating a function called displayNotes() which on being called will display a ordered list of notes with their status. This function will take no arguments.&lt;br&gt;
In displayNotes() function, we will use forEach() to loop through the array and display it to the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yah142sg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/8vk3gupdosbxm5n2c2mh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yah142sg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/8vk3gupdosbxm5n2c2mh.png" alt="displayNotes() function" width="637" height="145"&gt;&lt;/a&gt;&lt;/p&gt;
 displayNotes() function 



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xNZipvbb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9jl8aemdp0ebv3rot8lg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xNZipvbb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9jl8aemdp0ebv3rot8lg.png" alt="Output : displayNotes() function" width="504" height="123"&gt;&lt;/a&gt;&lt;/p&gt;
 Output : displayNotes() function 


&lt;h1&gt;
  
  
  U for Update...
&lt;/h1&gt;

&lt;p&gt;Here, we will be creating 2 functions called updateNote(oldtitile, newtitle) &amp;amp; updateNoteStatus(title, newStatus).&lt;br&gt;
updateNote(oldtitile, newtitle) will update the title name of an existing note. This function will use findIndex() method to search for the existing note and will return its index number. Then using the return value, we will update the Title of the note.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h61-QA5Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mog60mo8fb71z8pxaic3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h61-QA5Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mog60mo8fb71z8pxaic3.png" alt="updateNote() function" width="563" height="203"&gt;&lt;/a&gt;&lt;/p&gt;
 updateNote() function 



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LUA6LX7_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/sn3v6z7sjtfl4srj3k6j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LUA6LX7_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/sn3v6z7sjtfl4srj3k6j.png" alt="Output : updateNote() function" width="426" height="117"&gt;&lt;/a&gt;&lt;/p&gt;
 Output : updateNote() function 



&lt;p&gt;updateNoteStatus(title, newStatus) will update the completion Status of the Note. This function will also use findIndex() method to search for the existing note and will return its index number. Then using the return value, we will update the Status of the note.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eHOJhNUi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7zblo3ewmd4rfog4jarj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eHOJhNUi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7zblo3ewmd4rfog4jarj.png" alt="updateNoteStatus() function" width="571" height="211"&gt;&lt;/a&gt;&lt;/p&gt;
 updateNoteStatus() function 



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lkmftA5X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jfsffgmnjbsdfurt0zbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lkmftA5X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jfsffgmnjbsdfurt0zbc.png" alt="Output : updateNoteStatus() function" width="418" height="124"&gt;&lt;/a&gt;&lt;/p&gt;
 Output : updateNoteStatus() function 


&lt;h1&gt;
  
  
  D for Delete...
&lt;/h1&gt;

&lt;p&gt;Here, we will be creating a function called deleteNote(title) which will delete the note on the basis of the title passed as the argument in the function.&lt;br&gt;
This function will also use findIndex() method to search for the existing note and will return its index number. Then using the return value, we will implement the splice() method to remove the note.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KrDB6PXa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7jgdj2zjeotz8hgizdqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KrDB6PXa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7jgdj2zjeotz8hgizdqy.png" alt="deleteNote() function" width="572" height="206"&gt;&lt;/a&gt;&lt;/p&gt;
 deleteNote() function 



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i0hKxe1r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/chmy2xle8dypfjewlyoc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i0hKxe1r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/chmy2xle8dypfjewlyoc.png" alt="Output : deleteNote() function" width="429" height="116"&gt;&lt;/a&gt;&lt;/p&gt;
 Output : deleteNote() function 



&lt;p&gt;&lt;strong&gt;Finally, we have coded and implemented CRUD operations using Pure Modern JavaScript.&lt;br&gt;
Attaching below the code via public GitHub gist link.&lt;/strong&gt;&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;If you liked my efforts, do encourage this post with comments and feedback.&lt;br&gt;
Thank You !&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;





&lt;div class="ltag__user ltag__user__id__"&gt;
  
    .ltag__user__id__ .follow-action-button {
      background-color: #19063A !important;
      color: #dce9f3 !important;
      border-color: #19063A !important;
    }
  
    &lt;div class="ltag__user__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b_Q_OnuL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--diPD5F8K--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://thepracticaldev.s3.amazonaws.com/i/99mvlsfu5tfj9m7ku25d.png" alt="[deleted user] image"&gt;
    &lt;/div&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;[Deleted User]&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


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