up
This commit is contained in:
parent
5372c18379
commit
3defacc09d
314 changed files with 1761 additions and 1704 deletions
24
1-js/4-object-basics/04-object-methods/7-calculator/task.md
Normal file
24
1-js/4-object-basics/04-object-methods/7-calculator/task.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
importance: 5
|
||||
|
||||
---
|
||||
|
||||
# Create a calculator
|
||||
|
||||
Create an object `calculator` with three methods:
|
||||
|
||||
- `read()` prompts for two values and saves them as object properties.
|
||||
- `sum()` returns the sum of saved values.
|
||||
- `mul()` multiplies saved values and returns the result.
|
||||
|
||||
```js
|
||||
let calculator = {
|
||||
// ... your code ...
|
||||
};
|
||||
|
||||
calculator.read();
|
||||
alert( calculator.sum() );
|
||||
alert( calculator.mul() );
|
||||
```
|
||||
|
||||
[demo]
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue