0

I am trying to learn how to create my own object and i can't understand the "this" part. Is that representing the function "person"? And why do we have to type .name = name?

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

    var bucky = new person("bucky roberts", 24);
    var perry = new person("perry smith", 20);

    </script>






<script type="text/javascript">
    document.write(bucky.name);
</script>
Ralphunreal
  • 173
  • 8

0 Answers0