Monday 4 June 2018

Analysis of javaScript in relation to QuizApplication

The tool which performs the most important operation of QuizApplication is javaScript - powerful web-based programming language used to handle user input, display output, decide what to do next, and deal with operations makes by the user.

First of all, if the developer wants to use one of capabilities of the javaScript - it is necessary to prepare the main idea of entire application and design how it should work.
After that the commands and calculations to be performed should be wrapped in the functions with it's name and parameters.

For example function buildQuiz()
function buildQuiz(){
  // we'll need a place to store the HTML output
  const output = [];

  // for each question...
  myQuestions.forEach(
    (currentQuestion, questionNumber) => {

      // we'll want to store the list of answer choices
      const answers = [];

      // and for each available answer...
      for(letter in currentQuestion.answers){

        // ...add an HTML radio button
        answers.push(
          `<label>
            <input type="radio" name="question${questionNumber}" value="${letter}">
            ${letter} :
            ${currentQuestion.answers[letter]}
          </label>`
        );
      }

      // add this question and its answers to the output
      output.push(
        `<div class="question"> ${currentQuestion.question} </div>
        <div class="answers"> ${answers.join('')} </div>`
      );
    }
  );

  // finally combine our output list into one string of HTML and put it on the page
  quizContainer.innerHTML = output.join('');
}
This function store the answer choices,adds HTML radio button for each question, adds question and answers to the output and finally combine output into HTML string and display as results on the page


Web design Hull Web design services Freelance web designer web design blog IT specialist Why is the mobile version of the website important? What it's SSL certificate and how it benefits website? The most important features for e-commerce store? Why website does not appear in Google results? Content marketing is a wide field in which our imagination is the only limitation What is the guideline when choosing a hosting for the website? What is worth paying attention to when designing your company's website? The value of blogging in the terms of website design. Freelance web designer - Why do you need affordable website? The ultimate guide how to become freelancer in 2020 6 Features of best UX for web design in 2020 How works Google Assistant. OK Google get started 6 website types which hit the trends in 2020. 10 reasons why CMS need to die in 2020. What is ZCash and how does this modern cryptocurrency work? 5 Best ways to make money online in 2020. How you can make money online - find something adequate to skills The comprehensive guide how to become programer in London - 2020.

1 comment:

  1. Have you had any issues with the progress of your app? This clearly shows progress at a good level.

    ReplyDelete