0

I watched a tutorial and did the same exact thing. now, this "not defined" error keeps showing I even tried in another browser but the same result. I'm new to JS need help thank you.

<html>
<head>
<script type="text/javascript">


function person(name, age){
  this.name = name;
  this.age = age;

}

  
  var milz = new person("milz", 23);
  var stefi = new person("stefi", 19);

</script>
</head>




<body>
<script type="text/javascript">
document.write("hello ");
document.write(stefi.age);


</script>
</body>
</html>
user961954
  • 3,214
  • 2
  • 17
  • 24

1 Answers1

2

<html>
<head>
<script type="text/javascript">


function person(name, age){
  this.name = name;
  this.age = age;
  
  
}
var milz = new person("milz", 23);
  var stefi = new person("stefi", 19);

</script>
</head>




<body>
<script type="text/javascript">
document.write("hello ");
document.write(stefi.age);


</script>
</body>
</html>
BeiBei ZHU
  • 343
  • 2
  • 12