<?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: JaswanthReddyPadala</title>
    <description>The latest articles on DEV Community by JaswanthReddyPadala (@jaswanthreddypadala).</description>
    <link>https://dev.to/jaswanthreddypadala</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%2F515427%2F50137bc2-a8db-4c25-90e0-78e812374c68.jpeg</url>
      <title>DEV Community: JaswanthReddyPadala</title>
      <link>https://dev.to/jaswanthreddypadala</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jaswanthreddypadala"/>
    <language>en</language>
    <item>
      <title>GIT FOR A BEGINNER</title>
      <dc:creator>JaswanthReddyPadala</dc:creator>
      <pubDate>Wed, 25 Nov 2020 13:04:49 +0000</pubDate>
      <link>https://dev.to/jaswanthreddypadala/git-for-a-beginner-2g1n</link>
      <guid>https://dev.to/jaswanthreddypadala/git-for-a-beginner-2g1n</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;GIT?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Git was created by Linus Torvalds in 2005 for the development of the Linux kernel, with other kernel developer team. Git is a distributed version control tool. In simple language, Git is like a record book, it keeps on tracking your files and changes made in project files. &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;WHY GIT?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Although there are dozens of version control systems on the market like CVS, SVN, Mercurial, Bazaar, etc. But let's know what makes git more popular and powerful?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Save time&lt;/strong&gt;&lt;br&gt;
Git is a cool and very fast tool. Simple commands save us a lot of time. We can easily push codes and it improves team collaboration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Offline&lt;/strong&gt;&lt;br&gt;
Git can also be used in offline mode expect when you try to push your code to an online repository or cloud. But if you're using CVS you need to be connected to the central repository. This is not the case with git, you can happily do everything in your local machine itself like add, make commits, merge or create branches, push your codes, and many actions as you explore.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Undo or Redo mistakes&lt;/strong&gt;&lt;br&gt;
Generally, people make mistakes. It is one of the features in git is like a undo command. If you have messed up your code at some point in time then you can "undo" and go back in time in sense of code where you have a working code in the commit history. You can even restore disappeared commits. Awesome right?. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clone a project&lt;/strong&gt;&lt;br&gt;
If you ever see a good project in someone's repository and if you want to work on it and make your own version of that project. Git gives the functionality of cloning the project without deleting anything from the original repository. It copies whole files in someone's repository to your local machine and any changes you made in those files don't affect the original repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Commits&lt;/strong&gt;&lt;br&gt;
A commit is really useful if it contains related changes. When you change or add some feature you give a commit message and explaining about the change you committed in a meaningful way. For example, the person is adding a new feature 'A' he can commit something like "added feature A". In case the feature 'A' is not working properly we can revert back to the code before adding this new feature.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Don't touch working code&lt;/strong&gt;&lt;br&gt;
While you’re working on the feature 'A', What will be the situation if the new feature 'A' is not needed after making several commits to the main code. While developing a working code, nothing else should be affected by your unfinished code. To deal with this kind of situation &lt;em&gt;Branching&lt;/em&gt; is the only option. Using this feature, we can create a new branch to the main code without disturbing the main code. And later if the new code perfectly fits and works with then we can merge this branch with the main branch to develop a fully working code with the new feature 'A'.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So why late, start learning how to this awesome tool and use git&lt;/p&gt;

&lt;p&gt;Resources: &lt;a href="https://git-scm.com/book/en/v2"&gt;Git book&lt;/a&gt; | &lt;a href="https://training.github.com/downloads/github-git-cheat-sheet/"&gt;Git cheat sheet&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Leave you thoughts in the comment section&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Thank you for reading 🙏&lt;/strong&gt;&lt;br&gt;
Jaswanth Reddy Padala  - &lt;a href="//jaswanthreddypadala@gmail.com"&gt;Email&lt;/a&gt; | &lt;a href="https://www.linkedin.com/in/jaswanthreddypadala/"&gt;Linkedin&lt;/a&gt; | &lt;a href="https://twitter.com/jaswanthreddyp2"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>github</category>
      <category>git</category>
      <category>web</category>
    </item>
    <item>
      <title>START LEARNING JS</title>
      <dc:creator>JaswanthReddyPadala</dc:creator>
      <pubDate>Wed, 18 Nov 2020 12:36:39 +0000</pubDate>
      <link>https://dev.to/jaswanthreddypadala/start-learning-js-57bk</link>
      <guid>https://dev.to/jaswanthreddypadala/start-learning-js-57bk</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;LEARN JAVASCRIPT BASICS&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;Learn to appreciate yourself and celebrate small wins&lt;/code&gt; --- This helps you keep on motivating&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Basics of Javascript&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;JavaScript ("JS" for short) is a full-fledged dynamic programming language that can add interactivity to a website. It was invented by Brendan Eich (co-founder of the Mozilla project, the Mozilla Foundation, and the Mozilla Corporation) Click here, to know the complete history of &lt;strong&gt;&lt;a href="https://en.wikipedia.org/wiki/JavaScript"&gt;Javascript&lt;/a&gt;&lt;/strong&gt; till now.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Hello World!&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Hello World!");

//console.log() is one of the javascript inbuilt function which allows us to print anything in the code at the output.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. &lt;strong&gt;Input from user&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;prompt is an inbuilt function in javascript which creates a dialogue box to enter user input. But this works only in the browser console. This method of taking input is not suggested but learn its existence.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;prompt("What is your name?");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. &lt;strong&gt;Variables&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Javascript contains containers which store the values called &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Variables"&gt;Variables&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var myName = "Jaswanth";
var myAge = 19;
let myPlace = "Rajahmundry";
.
.
.
//many things were there to know about these variables, so go through the above link.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. &lt;strong&gt;Data types in JS&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Different kinds of data were names with different names. &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures"&gt;Data types&lt;/a&gt; like integer, string, character, float, booleans. And in advanced &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array"&gt;Array&lt;/a&gt;, and many more. We learn them on the go.&lt;/p&gt;

&lt;p&gt;Apart from these, you should also know about &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Type_coercion"&gt;type coercion&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var integer= 723; // It is a Integer(number);
var deciamalNumber = 200.76349; //It is a Float(decimal number)
var str = "Javascript is a scripting language."  //It is String(text)
let bool = True //Boolean (True or False)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. &lt;strong&gt;Conditional statements&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;if statement&lt;/strong&gt; :: To check whether a condition is satisfied to execute a part of the code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;if-else&lt;/strong&gt; :: It behaves like if the condition in if the statement is true then the code execute the part enclosed within if or else it runs the part which&lt;br&gt;
is enclosed within else statement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;nested-if&lt;/strong&gt; :: If an if the statement is true then it checks for the next if statement which is inside an if statement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;if - else if - else&lt;/strong&gt; :: This is like if a condition is not true if check another if statement outside if statement.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;if statement&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// if statement-syntax

var myAge = 19;
if(check_condition){
    //if true execute statements inside this
}


//if statement - example

if (myAge &amp;gt;=18){
    console.log("you are above 18);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;if-else&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//if-else  - syntax

if(check_condition){
    //if true execute statements inside this
}
else{
    //if false execute statements inside this
}


//if-else  - example

var myAge = 16;
if (myAge &amp;gt;= 18){
    console.log("you are above 18);  //does not execute this
}
else{
    console.log("you are below 18);  //executes and prints "you are below 18"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;nested if&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

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

if(check_condition-1){
    //if true
    if(check-condition-2){
        //if true
        if(check-condition-3){
            ... // this goes on till every check condition is true
        }
    }
}

* if any of the check condition is false it comes out and executes the rest of the statements below that if statement. *

//example
var myAge = 19;
var myName = "Jaswant";
if(myAge &amp;gt;= myAge){     //condition is true
    if (myName == "Jaswanth"){ //condition is false
        console.log("You are Jaswanth");
    }
    console.log("You are",myAge);
}

output -
You are 19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Loops&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Developers follow the "DRY" principle which means - DO NOT REPEAT YOURSELF. So they make use of loops, functions, algorithms, patterns, and many more. Now we can learn what are loops.&lt;br&gt;
Looping is the concept of running a set of statements multiple times until the conditions inside looping statements become false.&lt;br&gt;
Refer here to learn about different types of loops.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for#:~:text=The%20for%20statement%20creates%20a%20loop%20that%20consists,interactive%20example%20is%20stored%20in%20a%20GitHub%20repository."&gt;for loop&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;for - syntax&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for(INITIALIZATION, CHECK_CONDITION, INCREMENT/DECREMENT){
    //set of statements to be executed
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;for - example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for(let i=0; i&amp;lt;5; i++){
    console.log("hello..");
}

// let i = 0  --&amp;gt;  initialize i = 0;
// i&amp;lt;5 --&amp;gt; checks wheather the value of i is less than 5
// i++ --&amp;gt; increment the value of i by 1 value(i=i+1)
//This loop runs for 5 times and print "hello.."
hello..
hello..
hello..
hello..
hello..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while"&gt;while&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;while - syntax&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//
while(CHECK_CONDITION){
    //set of statements to be executed
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;while - example&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var i = 0;
while(i&amp;lt;5){
    console.log("hello..");
    i++;
}

//This loop runs 5 times and print "hello.."
hello..
hello..
hello..
hello..
hello..

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/do...while"&gt;do while&lt;/a&gt; -- This is a special type of while loop in which initially the loop will run at least for one time even though the condition is not satisfied.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;do-while  - syntax
do{
    //set of statements to be executed
}while(CHECK_CONDITION);

//do-while  - example
let k=10;
do{
console.log(k);
k++;
}while(k&amp;lt;0)

//output -
10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Functions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Functions were used to perform a specific set of functions by passing input and getting outputs from it. We can call the function multiple times with different inputs and perform the same task and get different outputs each time(different inputs).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//defining a function - syntax
function FUNCTION_NAME(PARAMETERS){    //parameters are the optional inputs which were received by the function to do something with them and give output
    //set of statements to be executed when function is called
}

//function calling - syntax
FUNCTION_NAME(ARGUMENTS); //argumentss are the optional values which were to be passed to functions as inputs for that function

//example
function printName(name){  //name is parameter
    console.log("Hi " + name);
}

//calling a function
printName("Tanay");     // Tanay is an argument --&amp;gt; this print :  "Hi Tanay"
printName("Akanksha");     // Akanksha is an argument--&amp;gt; this print :  "Hi Akanksha"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Setting up the project&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;a href="https://repl.it/"&gt;repl&lt;/a&gt; (explore repl, it is an interesting web app to use).&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p1KgD8EQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/./images/repl-login.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p1KgD8EQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/./images/repl-login.png" alt="Main Page of repl"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, if you are new to repl then create a new account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open a new repl and select node.js under node.js&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P4NFY8Qc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/./images/new-repl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4NFY8Qc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/./images/new-repl.png" alt="New repl"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now you will enter into Javascript with node.js console.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1IfGcaPk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/./images/new-console.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1IfGcaPk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/./images/new-console.png" alt="New repl"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don't get confused it will take time to get used to it. Explore repl in your free time.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Quiz project&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now, let's get into our simple javascript and nodejs project. In this simple project, we build a simple Command Line Interface quiz. Eventually while doing the project let us build our project.&lt;/p&gt;

&lt;p&gt;What we will be learning by doing this project?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Taking inputs (using 'readline-sync' npm package)&lt;/li&gt;
&lt;li&gt;Printing output&lt;/li&gt;
&lt;li&gt;Using operators&lt;/li&gt;
&lt;li&gt;Usage of if and if-else&lt;/li&gt;
&lt;li&gt;Usage of for loops&lt;/li&gt;
&lt;li&gt;Usage of basic data structures like arrays, dictionary&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The objective of creating this project is to create a quiz about MARVEL&lt;/p&gt;

&lt;h3&gt;
  
  
  For taking user inputs we use a npm package called &lt;a href="https://www.npmjs.com/package/readline-sync"&gt;&lt;strong&gt;'readline-sync'&lt;/strong&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  To use this package in your library type the below code to make it available for our project.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var readlineSync = require('readline-sync')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now input the player_name and print the welcome message. '\n' is an escape character. Know about escape characters in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String"&gt;strings&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var playerName = readlineSync.question("Enter your name: ");
console.log("Welcome to the quiz ",playerName+"\n");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now initialize player_score&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var playerScore = 0;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's create a sample &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array"&gt;array&lt;/a&gt; of 3 question&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object"&gt;objects&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const generalQuiz = [
    {
        question: "Who is the prime minister of india?",
        a: "Tanay Pratap",
        b: "Bumrah",
        c: "Narendra Modi",
        d: "Dhoni",
        correctAnswer: "c"

    },
    {
        question: "Who is the president of america?",
        a: "Jaswanth",
        b: "James Cameron",
        c: "Kamala Harris",
        d: "John Beiden",
        correctAnswer: "d"
    },
    {
        question: "Which is the largest continent?",
        a: "Asia",
        b: "Africa",
        c: "South America",
        d: "Europe",
        correctAnswer: "a"

    },
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wow, we used arrays and objects as each item in an array. Now we need to print these questions for our player. So we use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for"&gt;for&lt;/a&gt; loop to it now.&lt;/p&gt;

&lt;p&gt;We need to use for loop to iterate over each and every question and only if the answer is correct we can add 1 to player_score.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// we declare function so that the function playQuiz takes in different objects but conducts and evaluate quiz

function playQuiz(quiz){
    for (let i = 0; i &amp;lt; quiz.length; i++)
    {
        console.log(`${i + 1}. ${quiz[i].question}`);
        console.log(`          a: ${quiz[i].a}`);
        console.log(`          c: ${quiz[i].b}`);
        console.log(`          b: ${quiz[i].c}`);
        console.log(`          d: ${quiz[i].d}`);
        var answer = readlineSync.question("Answer: ");
        console.log("\n");

        //now validate answer
        if (answer.toLowerCase() == quiz[i].correctAnswer){
        playerScore = playerScore + 1;
        }
    }
    return playerScore;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now each time the player answers correctly the score increases.&lt;/p&gt;

&lt;p&gt;Now finally print the user's score at last.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let finalScore = playQuiz(generalQuiz); // here we called the playQuiz function and stored the final score of the player in finalScore variable.

console.log("Woohooo!!, you scored "+finalScore);   // printing final score.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;OUTPUT&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zDYfdLH8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/./images/output.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zDYfdLH8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/v1/./images/output.JPG" alt="Output of above program"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;YAY!! you have done a CLI project, Though it is simple this will help you in building your fundamentals well.&lt;br&gt;
&lt;em&gt;Hope you learned the basics OF javascript&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  REPL link for above code &lt;a href="https://repl.it/@jaswanthreddyp/QUIZ?embed=1&amp;amp;output=1#index.js"&gt;PLAY QUIZ&lt;/a&gt; | &lt;a href="https://repl.it/@jaswanthreddyp/QUIZ#index.js"&gt;QUIZ CODE&lt;/a&gt;
&lt;/h3&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;EXPLORE JAVASCRIPT RESOURCES&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript"&gt;MDN DOCS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://eloquentjavascript.net/Eloquent_JavaScript.pdf"&gt;Eloquent Javascript book&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/playlist?list=PLzvhQUIpvvuj9nN70USkHJrrSeQ9aiqdB"&gt;Tanay Pratap's Javascript playlist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/getify/You-Dont-Know-JS"&gt;You don't know javascript&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;YOUR FEEDBACK WOULD BE USEFUL TO IMPROVE THIS DOCUMENTATION ❤&lt;/strong&gt;
&lt;/h3&gt;

&lt;h2&gt;
  
  
  If you like the documentation, write me on &lt;a href="https://twitter.com/jaswanthreddyp2"&gt;Twitter&lt;/a&gt; | &lt;a href="https://www.linkedin.com/in/jaswanthreddypadala/"&gt;Linkedin&lt;/a&gt; | &lt;a href="https://github.com/JaswanthReddyPadala/"&gt;Github&lt;/a&gt; | &lt;a href="mailto:jaswanthreddypadala@gmail.com"&gt;jaswanthreddypadala@gmail.com&lt;/a&gt;
&lt;/h2&gt;

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