-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobjects.js
35 lines (28 loc) · 833 Bytes
/
objects.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
function pokemon(name, attack, hp, isLegend, types){
this.name = name;
this.attack = attack;
this.hp = hp;
this.isLegend = isLegend;
this.types = types;
}
var charizard = new pokemon("Charizard", "Blaze", 266, false, ["fire", "flying"]);
console.log(charizard.name);
charizard.hp = 100;
console.log(charizard.hp);
function superHero(realName, ability, gender, archEnemy)
{
this.realName = realName;
this.ability = ability;
this.gender = gender;
this.archEnemy = archEnemy;
}
var deadpool = new superHero("Wade Wilson", ["Immortal", "Regenerate", "Ninja Moves"], "Heterosexual male but occasionally gay", "Ajax");
function printObjInfo(obj)
{
console.log("Super Hero Info is");
for(var key in obj)
{
console.log(key + ": " + obj[key]+" ");
}
}
printObjInfo(deadpool);