Coder Social home page Coder Social logo

js-training-practice's Introduction

JS Training: The Quiz Project

What is it ?

The quiz is a simple quiz built on client from a json file.

The has a simple schema:

Property Definition
title:String Title of the quiz
questions:Array<Object> Config of questions
questions[]:Object
questions[].problem:String Question's title
questions[].input:Object Field to display
questions[].input.type:String 'radio', 'checkbox', 'inputs' or 'input' (default)
questions[].input.options:Array labels of the options (only for 'radio', 'checkbox' or 'inputs')

Why?

It's a project to practice acquired knowledge in JS Training Course refactoring this code.

This code is not meant to be well done, but meant to be refactored. This way, you can refactor progressively fixing the main mistakes of the code.

How?

Please read the contributing guidelines

Commands

npm run dev

Runs the project on watch mode.

npm run test

Executes end-to-end tests on the app to check your change haven't broken anything.

⚠️ Caution! ⚠️

Tests are run with selenium and require to have Java JDK installed: http://www.oracle.com/technetwork/java/javase/downloads/index.html.

The tests were run successfully with Chrome v62

npm run test:dev

Executes end-to-end tests on watch mode. Tests will be reexecuted every time.

npm reset

Safely reinstalls the project.

Refactor phases

1. Operators And Closures

branch-icon refactor/operators-closures

  • Change scopes of variables from global scope to local scope.
  • Declare variables with let, const or var.
  • Use destructuring when possible.
  • Use operator expressions for conditionals and value assignment.

2. Strings

branch-icon refactor/strings

  • Convert strings to template strings.

3. Functions

branch-icon refactor/functions

  • Split all logic in functions as pure as possible.
  • Use new arrow functions syntax when possible.
  • Respect functional principles:
    • Immutability
    • Absence of side effects
    • Function don't depend on state
    • Functions with 1 input/ 1 output.

js-training-practice's People

Contributors

davidbarna avatar

Watchers

 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.