//sample solution
var setName = function(yourName){
this.name = "Your name is " + yourName;
};
// create an object called `human`
var human = new Object();
//make sure the human.name property is initialized
human.name = "";
//pattern the setHumanName method after the setName function
human.setHumanName = function(yourName){
this.name = "Your name is " + yourName;
};
// now call human.setHumanName
human.setHumanName("Jim");
// check to see that your method works by printing
// human.name to the console
console.log(human.name);
No comments:
Post a Comment