-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
85 lines (85 loc) · 2.58 KB
/
index.html
File metadata and controls
85 lines (85 loc) · 2.58 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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>World Cup Using Objects & Arrays</title>
</head>
<body>
<div id="display"></div>
<script>
var worldCup={
teams:[
{
name:"Pakistan",
totalMatches: 2,
lost:2,
win:0,
players:[
{
name:"Shahid Afridi",
specialty:"All Rounder",
strikeRate: 108,
best:125
},
{
name:"Ahmed Shahzad",
specialty:"Batsman",
strikeRate: 79,
best:105
},
{
name:"Saeed Ajmal",
specialty:"Bowler",
strikeRate: 79,
best:5
}
]
},
{
name:"India",
totalMatches: 2,
lost:0,
win:2,
players:[
{
name:"Virat Kohli",
specialty:"Batsman",
strikeRate: 101,
best:125
},
{
name:"M S Dhoni",
specialty:"Batsman, WicketKeeper, Captain",
strikeRate: 79,
best:175
},
{
name:"Irfan Pathan",
specialty:"Bowler",
strikeRate: 79,
best:175
}
]
}
]
};
var display= document.getElementById("display");
for(var i=0;i<worldCup.teams.length;i++){
var teamNow=worldCup.teams[i];
display.innerHTML+="<hr>"+"<div>"+"Team Name : "+teamNow.name+
", Total Matches : "+teamNow.totalMatches+
", Total Lost : "+teamNow.lost+
", Total Won : "+teamNow.win+"<div>"+"Players Data";
for(var j =0; j<teamNow.players.length;j++){
var playerNow=teamNow.players[j];
display.innerHTML+="<div>"+"<br>"+
" Name : "+playerNow.name+"<br>"+
" Specialty : "+playerNow.specialty+"<br>"+
" Strike Rate : "+playerNow.strikeRate+"<br>"+
" Best : "+playerNow.best+"</div>";
}
display.innerHTML+="<hr>";
}
</script>
</body>
</html>