-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathsolution.js
More file actions
42 lines (31 loc) · 696 Bytes
/
Copy pathsolution.js
File metadata and controls
42 lines (31 loc) · 696 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
42
// Task 1
var dairy = ['cheese', 'sour cream', 'milk', 'yogurt', 'ice cream', 'milkshake']
function logDairy(){
for(var item of dairy){
console.log(item)
}
}
// Task 2
const animal = {
canJump: true
};
const bird = Object.create(animal);
bird.canFly = true;
bird.hasFeathers = true;
function birdCan() {
for (var prop of Object.keys(bird)) {
console.log(prop + ": " + bird[prop])
}
}
// Task 3
function animalCan() {
for (var prop of Object.keys(bird)) {
console.log(prop + ": " + bird[prop])
}
for (var prop of Object.keys(animal)) {
console.log(prop + ": " + animal[prop])
}
}
logDairy();
birdCan();
animalCan();