-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
47 lines (38 loc) · 892 Bytes
/
javascript.js
File metadata and controls
47 lines (38 loc) · 892 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
43
44
45
46
47
var woolOwners = [
{
"master": 1
},
{
"dame": 1
},
{
"little boy": 1,
"location": "down the lane"
}
];
var bags = haveYouAnyWool;
var haveYouAnyWool = function() {
for (var i = 0; i < woolOwners.length; i++) {
var totalBags = totalBags + i;
}
return (i);
};
function baabaaBlackSheep() {
console.log("BaaBaa BlackSheep have you any wool?");
if (bags > 0) {
console.log("yes sir, yes sir " + totalBags + " bags full");
}
}
function oneForMy() {
for (var i = 0; i < 2; i++) {
people = Object.keys(woolOwners);
var person = people.toString();
console.log("one for my " + person);
}
}
baabaaBlackSheep();
oneForMy();
var boy = Object.keys(woolOwners[2]);
var littleBoy = boy[2];
var whereHeLives = littleBoy.location;
console.log("one for the " + littleBoy + " that lives " + whereHeLives);