2020-06-10 19:18:53 +00:00
|
|
|
## Change
|
|
|
|
|
|
|
|
### Instructions
|
|
|
|
|
|
|
|
Create 2 functions:
|
2021-04-27 19:04:54 +00:00
|
|
|
|
2022-04-29 23:13:32 +00:00
|
|
|
- `get`: a function that takes a key and returns the corresponding value from the `sourceObject`.
|
2020-06-10 19:18:53 +00:00
|
|
|
|
2022-04-29 23:13:32 +00:00
|
|
|
- `set`: a function that takes a key and a value. Update the value for the corresponding property of the `sourceObject` and return the value.
|
2020-06-10 19:18:53 +00:00
|
|
|
|
|
|
|
### Notions
|
|
|
|
|
2022-04-29 23:13:32 +00:00
|
|
|
- [Functions](https://nan-academy.github.io/js-training/examples/functions.js)
|
|
|
|
- [Data Structures](https://nan-academy.github.io/js-training/examples/data-structures.js)
|
|
|
|
- [Get](https://nan-academy.github.io/js-training/examples/get.js)
|
|
|
|
- [Set](https://nan-academy.github.io/js-training/examples/set.js)
|
2020-06-10 19:18:53 +00:00
|
|
|
|
|
|
|
### Code provided
|
|
|
|
|
2022-04-29 23:13:32 +00:00
|
|
|
> The provided code will be added to your solution, and does not need to be submitted.
|
2020-06-10 19:18:53 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
const sourceObject = {
|
|
|
|
num: 42,
|
|
|
|
bool: true,
|
|
|
|
str: 'some text',
|
|
|
|
log: console.log,
|
|
|
|
}
|
|
|
|
```
|