Coder Social home page Coder Social logo

javascriptinterview's Introduction

Code For Home Assignment

How To Run

npm install webpack -g
npm install webpack-dev-server -g
npm install
webpack-dev-server --progress -colors

This will be running a webpack testing server at port 8080. Use browser to access:

http://localhost:8080/webpack-dev-server/
  • First click reload, you will get a new cards deck which is not shuffled yet.
  • Then click shuffle button to shuffle the cards
  • Then click deal one card, to deal one card each time. When all of the cards are dealt, you will get message to ask you to reload and shuffle the cards
  • If just reload and not shuffle the cards, you will get the card in sequence when click deal one card button.

Technical Details

  • Card.js is the module files including class Card and CardsDeck. CardsDeck has the method shuffle() and dealOneCard() required for the home assignment
  • playground.js is the javascript file to test the result
  • entry.js is the packing javascript file to assemble every thing together

Credit

  • Continously improvement: So far the code can fit the requirement of the home assignment. I would not introduce more complexity to avoid over-engineering. As in real project, based on the coming requirements, I will always take time to review the existing code and do the continously improvement by refactoring
  • ES6: I have used some ES6 in the code, including class, let keyword, mutiple variables assignment and string templates.
  • Webpack: The whole code is organized and compiled by webpack
  • Lodash: So far, I didn't find the place suitable to use loadash. loadash may be used for the manipulating of the array to improve the performance(though for 52 cards, perforamnce would not be the problem).
  • Use Redux to react the user action, update the deck and show the value

javascriptinterview's People

Contributors

stelee410 avatar

Watchers

 avatar  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.