I'm trying to figure out why this particular code works
// .......................................................
var character = {
name: 'Joni',
type: 'blond',
sayName: function() {
return this.name;
},
sayType: function() {
return this.type;
}
};
document.write(character.sayName() + "</br>");
document.write(character.sayType());
// .......................................................
but for some reason, this one doesn't work
// .......................................................
var character = {
name: 'Joni',
type: 'blond',
sayName: function() {
return this.name;
},
sayType: function() {
return this.type;
}
};
document.write(character.sayName() + "</br>");
document.write(character.sayType());
// .......................................................
Any help would be appreciated. Thank you!