What is a JavaScript object?
Code:-
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<input type="button" value="Know about object" onclick="cal_fun();">
<div id="d1"></div>
<div id="d2"></div>
<script>
function cal_fun()
{
var schhis = {
school: "St,joseph's HSSS",
place: "Mulagumoodu",
year: "1984"
};
var student = {
stu1:
{
name1: "Merbin",
place: "Mulagumoodu"
},
stu2:
{
name2: "Franklin",
place: "Marthandam"
},
stu3:
{
name3: "Ramesh",
place: "Trivandrum"
}
}
document.getElementById('d1').innerHTML = "School Name : " + schhis.school + "School Place : " + schhis.place + " Year : " + schhis.year;
document.getElementById('d2').innerHTML = "Name 1 : " + student.stu1.name1 + "place : " + student.stu1.place;
}
</script>
</body>
</html>
JavaScript:- object
Reviewed by Network security
on
June 03, 2019
Rating:
No comments: