-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathour_solution.js
More file actions
117 lines (73 loc) · 2.67 KB
/
our_solution.js
File metadata and controls
117 lines (73 loc) · 2.67 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// GPS 1.2 - JavaScript
// YOUR FULL NAMES:
// 1.Krystyna Ewing
// 2.
// 0. "YOU SIGNED... WHO?!"
// Woody Harrelson
// Age: 52
//Quote: "I don't believe in it. You ever see a lion limber up before it takes down a gazelle?"
// this is object literal notation:
var woody = {
name: "Woody Harrelson",
age: 52,
quote: "I don't believe in it. You ever see a lion limber up before it takes down a gazelle?"
}
// 1. "Here they Come!"
var adam = {}
adam.name = "Adam"
adam.age = 47
adam.quote = "That's your home! Are you too good for your home?"
var kristin = {
name: "Kristin",
age: 33,
quote: "Do you wanna build a snowman?"
}
// this is a basic use of a constructor
var jim = new Client ()
jim.name = "Jim",
jim.age = 52,
jim.quote = "So you're telling me there's a chance?"
// 2. "TIME IS MONEY!"
function Client(name,age,quote){
this.name = name;
this.age = age;
this.quote = quote;
}
//YOUR CODE HERE!
// 3. "SHOW 'EM OFF!"
function printClient(client) {
console.log("Here is " + client.name + " and their age is " + client.age + " and their favorite quote is " + client.quote)
}
printClient(adam)
// 4. "But wait, there's more!"
var clients = ["Woody", "Adam", "Kristin", "Jim"]
function printall(clients)
for (i = 0; i < clients.length; i ++) {
printDisplay(clients[i]);
};
// 5. ** BONUS **
var moneyMaker(client) {
adam.moneyMaker = 10,000,000
kirstin.moneyMaker = 8,000,000
woody.moneyMaker = 12,000,000
jim.moneyMaker = 9,000,000
}
// Driver Test Code
var shooterMcGavin = new Client("Shooter McGavin", 48, "Just stay out of my way... or you'll pay. Listen to what I say.");
console.log(shooterMcGavin.constructor === Client);
console.log(shooterMcGavin.age === 48);
shooterMcGavin.quote === "Just stay out of my way... or you'll pay. Listen to what I say.";
console.log(woody.constructor === Object);
console.log(woody.age === 52);
console.log(woody.quote === "I don't believe in it. You ever see a lion limber up before it takes down a gazelle?")
console.log(adam.name === "Adam")
console.log(adam.age === 47)
console.log(adam.quote === "That's your home! Are you too good for your home?")
console.log(kristin.age === 33)
console.log(jim.constructor === Client)
console.log(jim.age === 52)
shooterMcGavin.showQuote();
// 6. Your Reflection
// Really stunk to have to do this on my own, but that's been sort of a running theme when it comes to my gps sessions
// Learned some things with it, stumbled on some things as well, will be reading up more on constructors and whatnot to
//tru and improve my knowledge on this, I do know one thing, if you try to do too much too soon, you burn yourself out.