You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
471 B

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function people(name, age){
this.name = name;
this.age = age;
this.yearsUntilRetire = yearsLeft;
}
function yearsLeft(){
var numYears = 65 - this.age;
return numYears;
}
var natalie = new people("Natalie Portman", 28);
var bucky = new people("Bucky roberts", 24);
</script>
</head>
<body>
<script type="text/javascript">
document.write(bucky.yearsUntilRetire());
</script>
</body>
</html>