Web programming
NAME: R HEMESH REG NO. 22BCT0328
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body><br><br>
<div id="c"></div><br><br>
<div id="b"></div><br><br>
<div id="a"></div>
<script>
obj={name:"Hemesh",id:328,code:"1/3",context:"1st method -By creating
object literal"}
document.getElementById("c").innerHTML+=("CONTEXT:"+obj.context+"<br>NAME:"+o
bj.name+"<br>ID:"+obj.id+"<br>completion of work: "+obj.code)
var obj2= new Object();
obj2.context="2nd method -By creating new instance of the object"
obj2.co="2/3"
document.getElementById("b").innerHTML+=("CONTEXT:"+obj2.context+"<br>"+"comp
letion of work:"+obj2.co)
function job(name,id,salary,work){
this.name=name;
this.id=id;
this.salary=salary;
this.work=work;}
obj3= new job("Hemesh",000111,25000,"3RD METHOD-This is created using
object constructor")
document.getElementById("a").innerHTML+=obj3.work+"<br>"
document.getElementById("a").innerHTML+="Name:"+obj3.name+"<br>ID:"+obj3.id+"
<br>SALARY:"+obj3.salary
</script>
</body>
</html>