Can I see your references? I need a better understanding


#1

How come you have to change James's job like this [ james.job="super programmer"; ] (without the brackets). Why couldn't we just use the [ james.sayJob( ); ] to change his job. I thought that was the point of the function. Any clairifcation would be appericated!


var james = {
    job: "programmer",
    married: false,
    sayJob: function(job) {
        // complete this method
        console.log("Hi, I work as a "+this.job);
    }
};

// james' first job
james.sayJob();

// change james' job to "super programmer" here
james.job="super programmer";

// james' second job
james.sayJob();


#2

you can update a property (job) of an object (james) by doing using the following syntax:

objectName.popertyName = "new value"

the purpose of the sayJob method is to tell which job james is doing, not to update the job.


#3

Thank you for your response :grin:


#4