-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day 5
34 lines (25 loc) · 917 Bytes
/
Day 5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
DAY 5
Instructions
(This challenge is worth 10 points)
Click here to learn how to navigate the code editor
Now that a crew has been selected, you need to write a new function that will assign a job to each astronaut. Since you’ve had some experience with updating object properties in some of the previous challenges, this should be fairly straightforward. Just keep in mind that you need to return the astronaut after updating the job property.
Examples
Input:
const exampleAstronaut = {
firstName:"Chris",
lastName: "Hadfield",
nickname:"Space Oddity",
prefix:"Astronaut"
}
Output:
const exampleAstronaut = {
firstName:"Chris",
lastName: "Hadfield",
nickname:"Space Oddity",
prefix:"Astronaut",
job:"Shuttle DJ"
}
SOLUTION
function addJobToAstronaut(astronaut, job) {
return {...astronaut, "job": job};
}