Literally Speaking & this


#1



intro to objects 2 - 3

tells me I'm not outputting the correct string. However if i switch (this) for (speak) i get the ok but the console prints nothing.

var james = {
    job: "programmer",
    married: false,
    speak: function() {
        console.log("Hello, I am feeling" + this)  // but (speak) works fine here //
        
    }
};

james.speak("great");
james.speak("just okay");


#2

console.log("Hello, I am feeling" + this)
"this" is nothing here

At first take a parameter for function like this

function(mood)

and now

console.log("Hello, I am feeling" + mood)

hope this'll make sense :slight_smile: