emortong / cash-register Goto Github PK
View Code? Open in Web Editor NEWThis project forked from devleague/cash-register
Closure and Revealing Module Pattern exercise
This project forked from devleague/cash-register
Closure and Revealing Module Pattern exercise
Get the decimal place working. so you can do math operations on 1.2 + 1.4 = 2.6
At the top of your cash register - you have 4 lines of code that is commented out. Be sure to remove commented out code from your commits.
// var getTotal = myCalc.getTotal();
// var recallMemory = myCalc.recallMemory()
// var saveMemory = myCalc.saveMemory();
// var clearMemory = myCalc.clearMemory();
For each click event, refactor each click event function to use a function for the code that repeats itself in each function. For example, this code could be made into a new function:
if(total !== 0) {
display.innerHTML = total
}
var disp = Number(display.innerHTML);
total = myCalc.load(disp);
operator = true;
Make your calculator beautiful!
If you need a style guide - use the calculator built into your Mac or your iPhone as a style guide reference. That thing is so well nice looking.
I want you to break up the code in your cashRegister.js into two modules. Refactor your cashRegister.js to use Revealing Module pattern and have it be responsible for only handling cash register specific tasks like withdrawing and depositing money. You can use the calculator.js module for this.
Then, in your app.js, I want you to put the logic for your application. This file does not need to use revealing module pattern. In this file put all of your app logic and click event logic here. This will be the "brain" of your app that pulls all of your modules together.
Let me know if this seems weird or your have any questions. ๐
When you are done, refactoring and styling, you can deploy your application to Github pages. This is so you can share your app with the world!
Add a link to your deployed app to your README.md
Links to deplot to gh-pages:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.