JavaScript의 개체는 프로토타입에서 속성과 메서드를 상속합니다. 우리는 일반적으로 Object.prototype에서 상속받는 new Object()로 하나를 만듭니다. 같은 방법으로 new Date()가 있는 객체는 Date.prototype을 상속합니다.
예시
<!DOCTYPE html>
<html>
<body>
<h2>Department Details</h2>
<p id="details"></p>
<script>
function Department(myid, name, section) {
this.id = myid;
this.name = name;
this.section = section;
}
var myDept = new Department("AKD", "Marketing", "North");
document.getElementById("details").innerHTML =
"The name and section of the Department is " + myDept.name + " and "
+ myDept.section+ " respectively.";
</script>
</body>
</html>