Fun with Functions recursion error


I don't know why I am getting this error.
Oops, try again.
When testing the Person constructor your code threw the following error: InternalError: too much recursion

function Person(job, married) {
    this.job = job;
    this.married = married;
    // add a "speak" method to Person!
    this.speak= Person()

var user = new Person("Codecademy Student",false);


I figured it out.. changed this.speak= person() --> this.speak = function(). Can someone explain the difference that would be great though.


I believe it's b/c Person is declared as a function already, and you can't call the function within it's function.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.