-
Notifications
You must be signed in to change notification settings - Fork 0
/
java.js
72 lines (50 loc) · 1.5 KB
/
java.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
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
var help = true;
if (help === true) {
console.log("yes it is true");
}else {
}
function Person(name,age) {
this.name = name;
this.age = age;
}
// Let's make bob and susan again, using our constructor
var bob = new Person("Bob Smith", 30);
var susan = new Person("Susan Jordan", 25);
// help us make george, whose name is "George Washington" and age is 275
var george = new Person ("George Washington" , 275);
/**********************************************/
function Cat(age, color) {
this.age = age;
this.color = color;
}
// make a Dog constructor here
function Dog(name , breed) {
this.name = name;
this.bredd = breed;
}
/**********************************************/
function Person(name,age) {
this.name = name;
this.age = age;
this.species = "Homo Sapiens";
}
var sally = new Person("Sally Bowles", 39);
var holden = new Person("Holden Caulfield" , 16);
console.log("sally's species is " + sally.species + " and she is " + sally.age);
console.log("holden's species is " + holden.species + " and he is " +holden.age );
/**********************************************/
function Rectangle(height, width) {
this.height = height;
this.width = width;
this.calcArea = function() {
return this.height * this.width;
};
// put our perimeter function here!
this.calcPerimeter = function(){
return(this.height + this.width )*2;
};
}
var rex = new Rectangle(7,3);
var area = rex.calcArea();
var perimeter = rex.calcPerimeter();
//Testing my Git functionality