Fun with functions error


#1

https://www.codecademy.com/en/courses/objects-ii/0/2?curriculum_id=506324b3a7dffd00020bf661

my code keeps saying that speak is undefined


function Person(job, married,speak) {
    this.job = job;
    this.married = married;
    this.speak = function() {
       var user = new Person("Codecademy Student",false);
 
        };
}


user.speak("Hello!");


#2

Hi you should put

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

outside the object Person

then here

this.speak = function() {

 };

you should put inside it

console.log("Hello!")

then when you will call the method speak on user don't put anything inside the the ()

Spoiler

user.speak();


#3

Can someone explain why we need "this" for the speak method?

Why can't we just straight up declare:

speak function () {

or

var speak = function () {


#4

Hi the this is well explan from that lesson The "this" Keyword

Why not ?

speak function () {

or

var speak = function () {

I'ts Because it's not a function but a Method of the contructore Person that why we use the Key this