Why won't I get both the return statement as well as console.log statement results?
The console.log outputs "Emily" but it won't output the text "says, that excessive coffee is awesome!"
function coffeeDrink(){
return this.name;
console.log("says, that excessive coffee is awesome!")
}
var literalMallory = {
name : "Mallory",
favDrink : coffeeDrink
}
var literalEmily = {
name : "Emily",
favDrink : coffeeDrink
}
coffeeDrink.call(literalEmily) //outputs "Emily"
I am expecting it to say: "Emily says, that excessive coffee is awesome!"