Can i see reference


#1

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

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

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


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

it doesn't give a output just tells job is not defined yet compiler said i done correct and asked to move on
can you let me know my mistake


#2

here you call the method to find out james first job:

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

then you update the job, but why change the method call? Why give the method call an argument of james.job all of a sudden?


#3

// create your Animal class here
var Animal=function(name,numLegs){
    this.name=name;
    this.numLegs=numLegs;
}


// create the sayName method for Animal
Animal.prototype.sayName=function(){
    console.log("Hi my name is [name]"+ " " + this.name);
}




// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);
penguin.sayName();

whats the mistake it says
Oops, try again. It looks like your Animal.prototype.sayName method does
not properly log to the console 'Hi my name is [name]' where [name] is the
name of the Animal/ create your Animal class here

var Animal=function(name,numLegs){
    this.name=name;
    this.numLegs=numLegs;
}


// create the sayName method for Animal
Animal.prototype.sayName=function(){
    console.log("Hi my name is [name]"+ " " + this.name);
}




// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);
penguin.sayName();

whats the mistake it says
Oops, try again. It looks like your Animal.prototype.sayName method does
not properly log to the console 'Hi my name is [name]' where [name] is the
name of the Animal/ create your Animal class here

var Animal=function(name,numLegs){
    this.name=name;
    this.numLegs=numLegs;
}


// create the sayName method for Animal
Animal.prototype.sayName=function(){
    console.log("Hi my name is [name]"+ " " + this.name);
}




// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);
penguin.sayName();

whats the mistake it says
Oops, try again. It looks like your Animal.prototype.sayName method does
not properly log to the console 'Hi my name is [name]' where [name] is the
name of the Animal/ create your Animal class here
var Animal=function(name,numLegs){
this.name=name;
this.numLegs=numLegs;
}

// create the sayName method for Animal
Animal.prototype.sayName=function(){
console.log("Hi my name is [name]"+ " " + this.name);
}

// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);
penguin.sayName();

whats the mistake it says
Oops, try again. It looks like your Animal.prototype.sayName method does
not properly log to the console 'Hi my name is [name]' where [name] is the
name of the Animal/ create your Animal class here

var Animal=function(name,numLegs){
this.name=name;
this.numLegs=numLegs;
}

// create the sayName method for Animal
Animal.prototype.sayName=function(){
console.log("Hi my name is [name]"+ " " + this.name);
}

// provided code to test above constructor and method
var penguin = new Animal("Captain Cook", 2);
penguin.sayName();
`
whats the mistake it says
Oops, try again. It looks like your Animal.prototype.sayName method does
not properly log to the console 'Hi my name is [name]' where [name] is the
name of the Animal


#4

This is a different exercise, you should have created a new topic

like the error message says, here:

 console.log("Hi my name is [name]"+ " " + this.name);

you should have replaced [name] with the variable containing the animals name, the exercise didn't give you this variable name on purpose, because it wanted you to think about it, but [name] has no part in the string


#5

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