-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjects.js
34 lines (27 loc) · 805 Bytes
/
Objects.js
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
// Write your fasterShip object literal below
let fasterShip = {
'Fuel Type': 'Turbo Fuel',
color: 'silver'
};
// Accessing the variable
let spaceship = {
homePlanet: 'Earth',
color: 'silver',
'Fuel Type': 'Turbo Fuel',
numCrew: 5,
flightPath: ['Venus', 'Mars', 'Saturn']
};
// Write your code below
let crewCount=spaceship.numCrew;
let planetArray=spaceship.flightPath;
// Accessing the object values by square brackets specially for the keys having spaces or numbers in it
let spaceship = {
'Fuel Type' : 'Turbo Fuel',
'Active Mission' : true,
homePlanet : 'Earth',
numCrew: 5
};
let propName = 'Active Mission';
console.log(spaceship[propName]);
// Write your code below
let isActive=spaceship['Active Mission'];