2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Write Concise Object Literal Declarations Using Simple Fields
|
|
|
|
---
|
2019-07-24 00:59:27 -07:00
|
|
|
# Write Concise Object Literal Declarations Using Simple Fields
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
---
|
|
|
|
## Problem Explanation
|
2018-10-12 15:37:13 -04:00
|
|
|
Here, we are tasked at returning an object that accepts the function's parameters as its attributes.
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
## Hints
|
|
|
|
|
|
|
|
### Hint 1
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
Get rid of the colons, and the duplicate words.
|
|
|
|
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
## Solutions
|
|
|
|
|
|
|
|
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
const createPerson = (name, age, gender) => {
|
|
|
|
"use strict";
|
|
|
|
// change code below this line
|
|
|
|
return {
|
|
|
|
name,
|
|
|
|
age,
|
|
|
|
gender
|
|
|
|
};
|
|
|
|
// change code above this line
|
|
|
|
};
|
|
|
|
```
|
2019-07-24 00:59:27 -07:00
|
|
|
</details>
|