JSFiddle - React, Tailwind, and code Playground

HTML

<div id="console-log"></div>

CSS

.console-line
{
    font-family: monospace;
    margin: 2px;
}

JavaScript

var consoleLine = "<p class=\"console-line\"></p>";
 
console = {
    log: function (text) {
        $("#console-log").append($(consoleLine).html(text));
    }
};

var obj = {
x: null,
func1: function() {
	console.log('func1, x is ' + this.x);
},

func2: function() {
	console.log("func2");
  this.func1();

	var func1 = this.func1;
  var self = this;
  func3(function() {
  	func1.call(self);
  });
}
};

function func3(callback) {
	console.log("func3");
	return callback();
}

obj.func2();