-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
54 lines (40 loc) · 807 Bytes
/
script.js
File metadata and controls
54 lines (40 loc) · 807 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
48
function func(s){
for(var i in s){
console.log(i);
}
}
function Multiplier () {
this.currentValue = null;
this.multiply=function(num){
if (this.currentValue == null){
this.currentValue = num*1;
return num*1;
}
else{
this.currentValue *= num;
return this.currentValue;
}
}
this.getCurrentValue=function(){
return this.currentValue;
}
}
function photo (name, location){
this.name = name;
this.location = location;
}
function album (){
this.photos = [];
}
var M1 = new Multiplier();
var p1 = new photo("mahedi", "queens");
var p2 = new photo("John", "Manhattan");
var a1 = new album();
a1.photos[0] = p1;
a1.photos[1] = p2;
//alert(M1.multiply(2));
//alert(M1.multiply(5));
func(M1);
func(p1);
for (i=0; i<a1.photos.length; i++)
alert(a1.photos[i].location);