Coder Social home page Coder Social logo

questions's Introduction

Questions

Coding Challenge: Basic

  • Let's build a fun quiz game in the console!

  • Build a function constructor called Question to describe a question. A question should include:

    • Question itself
    • The answers from whicih the player can choose the correct one (choose an adequate data structure here, array, object, etc.)
    • Correct answer(I would use a number for this.)
  • Create a couple of questions using the constructor

  • Store them all inside an array.

  • Select one random question and log it on the console, together with possible answers (each question should have a number) (Hint: write a method for the Question objects for this task)

  • Use the prompt function to ask the user for the correct answer. The user should input the number of the correct answer such as you displayed it on Task 4.

  • Check if the answer is correct and print to the console whether the answer is correct or not (Hint: write another method for this)

  • Suppose this code would be a plugin for other programmers to use in their code. So make sure that all your code is private and doesn't interfere with the other programmers code (Hint: we learned a special technique to do exactly that.)

Coding Challenge: Expert

  • After you display the result, display the next random question, so that the game never ends (Hint: write a function for this and call it right after displaying the result)

  • Be careful: After Task 8, the game literally never ends. So include the option to quit the game if the user write exit instead of the answer. In this case, don't call the function from Task 8,

  • Track the user's score to make the game more fun! So each time an answer is correct, add 1 point to the score (hint: I'm going to user the power of closures for thi, but you don't have to, just do this with the tools you feel more comfortable at this point.)

  • Display the score in the console. Use yet another method for this.

questions's People

Contributors

pau-riosa avatar jerickcamacho avatar equeferrer avatar tanlucky avatar pielagomrt avatar rjmssevilla avatar weltinio avatar wesleydelacruz avatar rookiemonkey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.