-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexerciseES8.js
More file actions
41 lines (31 loc) · 912 Bytes
/
exerciseES8.js
File metadata and controls
41 lines (31 loc) · 912 Bytes
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
// Solve the below problems:
// #1) Line up the Turtle and the Rabbit at the start line:
const startLine = ' ||<- Start line';
let turtle = '🐢';
let rabbit = '🐇';
// it should look like this:
' ||<- Start line'
' 🐢'
' 🐇'
// when you do:
console.log(startLine);
console.log(turtle);
console.log(rabbit);
turtle = turtle.padstart(8);
rabbit = rabbit.padstart(8);
// #2) What happens when you run turtle.trim().padEnd(9, '=') on the turtle variable
// Read about what the second parameter does in padEnd and padStart
turtle = turtle.trim().padEnd(9, '=');
// #3) Get the below object to go from:
let obj = {
my: 'name',
is: 'Rudolf',
the: 'raindeer'
}
// to this:
'my name is Rudolf the raindeer'
Object.entries(obj).map(value => {
let finalV = value[0] + " " + value[1];
return finalV;
}).join(' ');
//Object.entries(obj).map(value => value.join(" ")).join(' ');