https://github.com/yankouskia/smart-calculator
https://github.com/yankouskia/smart-calculator
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/yankouskia/smart-calculator
- Owner: yankouskia
- License: mit
- Created: 2018-02-19T15:16:49.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-08T20:08:08.000Z (over 6 years ago)
- Last Synced: 2025-03-31T12:07:50.888Z (25 days ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 2
- Watchers: 0
- Forks: 461
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# smart-calculator
## Task
Your task is to implement class `SmartCalculator`. All methods in class should be *chainable*. The priority of different operations should be kept in mind. It means, that `2 + 2 * 2` is `6`, not `8`.
For example:
```js
const calculator = new SmartCalculator(2);const value = calculator
.add(2)
.multiply(2);console.log(value); // 6
```Constructor should take initial value.
Be sure, that all tests work with *integers*.
Write your solution in `src/index.js`