In JavaScript why is function printing statement without any values to variables?

Viewed 19

When I execute the following code in JavaScript:

        const youtuber = {
            name: "rishi",
            content: "Politics",
            feature: function(){
                console.log(`My fav youtuber is ${this.name} and I like his view on ${this.content}.`)
            }
        }

        youtuber.feature();
        let youtubeFun = youtuber.feature;
        youtubeFun();

I get this output:

My fav youtuber is rishi and I like his view on Politics. My fav youtuber is and I like his view on undefined.

Can someone please explain why in second line of output there is no value in place of name and content?

0 Answers
Related