Write a JavaScript to create user-defined object.
Solution:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>User Defined Object</title>
</head>
<body>
<script type="text/javascript">
var car = new Object();
car.manufacturer="TATA";
car.model="Nexon";
car.price=754000;
document.write("Car Details");
document.write("<br>Manufacturer: "+car.manufacturer);
document.write("<br>Model: "+car.model);
document.write("<br>Price: "+car.price);
</script>
</body>
</html>
Output:<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>User Defined Object</title>
</head>
<body>
<script type="text/javascript">
var car = new Object();
car.manufacturer="TATA";
car.model="Nexon";
car.price=754000;
document.write("Car Details");
document.write("<br>Manufacturer: "+car.manufacturer);
document.write("<br>Model: "+car.model);
document.write("<br>Price: "+car.price);
</script>
</body>
</html>