-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day 2
43 lines (30 loc) · 1.1 KB
/
Day 2
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
35
36
37
38
39
40
41
42
DAY 2
Instructions
(This challenge is worth 5 points)
Click here to learn how to navigate the code editor
Registering new astronauts was handled manually in previous missions but it's taking too much time. Knowing that the astronaut information is already listed in a data set, you propose to optimize that job with programming.
Your task is to automate that process by creating a function that will take in an astronaut object as a parameter and return a string using the properties of the astronaut.
Examples
Input:
const exampleAstronaut = {
firstName: "Yuri",
lastName: "Gagarin",
nickname: "First!",
prefix: "Cosmonaut"
}
Output:
Cosmonaut: Yuri "First!" Gagarin
Input:
const exampleAstronaut = {
firstName: "Neil",
lastName: "Armstrong",
nickname: "Steps",
prefix: "Astronaut"
}
Output:
Astronaut: Neil "Steps" Armstrong
SOLUTION
function generateAstronautTag(astronaut){
let str = astronaut.prefix.concat(":", " ", astronaut.firstName, " ", "\"", astronaut.nickname, "\"", " ", astronaut.lastName)
return str
}