-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava.html
More file actions
60 lines (48 loc) · 1.42 KB
/
java.html
File metadata and controls
60 lines (48 loc) · 1.42 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
<!DOCTYPE html>
<html>
<head>
<title>Javascript</title>
<link rel="stylesheet" type="text/css" href="">
<script type="text/javascript">
var user=[
{name:"swaroopa", age:22, country:"India", hobbies:["reading", "painting"]},
{name:"roopa", age:21, country:"India", hobbies:["reading", "painting", "writing"]},
{name:"paru", age:32, country:"Us", hobbies:["reading", "writing"]},
];
function display(){
for(var i=0; i<user.length; i++){
document.write(user[i].name+" "+user[i].age+" "+user[i].hobbies+"<br>");
}
}
document.write("Displaying all the objects on the console");
document.write("<br>");
display();
document.write("<br>");
function display1(){
for(var i=0; i<user.length; i++){
if(user[i].age<30){
document.write(user[i].name+" "+user[i].age+" "+user[i].hobbies+"<br>");
}
}
}
document.write("Displaying all the objects on the console who's age is less than 30");
document.write("<br>");
display1();
document.write("<br>");
function display2(){
for(var i=0; i<user.length; i++){
if(user[i].country=="india" || user[i].country=="India"){
document.write(user[i].name+" "+user[i].age+" "+user[i].hobbies+"<br>");
}
}
}
document.write("Displaying all the objects on the console who's country is India");
document.write("<br>");
display2();
document.write("<br>");
</script>
</head>
<body>
<h6></h6>
</body>
</html>