JSFiddle - React, Tailwind, and code Playground

by Amir Danish

JavaScript

var greeting = 'hi';

const obj = {
  greeting: 'hey',

  fo() {
    let greeting = 'hola';

    const fo2 = function () {
      let greeting = 'hello';
       // console.log(this.greeting);

      const arrowFo = () => {
        console.log(this.greeting);
      };
      arrowFo();
    };
    fo2();
  },
};

obj.fo(); //logs: hi