JSFiddle - React, Tailwind, and code Playground

JavaScript

drink = 'soda'; //global variable

var Foo = function(){
    this.drink = 'beer'; //property of instance object
    console.log('Foo() -> ' + this.drink);
};

function bar(){
    console.log('bar() -> ' + this.drink);
};

var qux = {
    drink: 'wine', // in the scope of qux, 'drink' = 'wine'
    getDrink: function(){
        console.log('qux() -> ' + this.drink);
    }
};

//now see how "this' differs in each case
                    
var baz = new Foo(); // Foo() -> beer
bar(); // bar() -> soda
qux.getDrink(); // qux() -> wine