JSFiddle - React, Tailwind, and code Playground

HTML

<button id="btn">click here </button>

JavaScript

var bob = {
  first_name: "Bob",
  last_name: "Jones",
  fullName: function() {
    console.log(this.first_name + " " + this.last_name);
    return this.first_name + " " + this.last_name;
  },
  printName: function() {
    var printFullName = function(){
      bob.fullName();
    };
    printFullName();
  }
}

bob.printName();

document.getElementById('btn').onclick = bob.printName;