JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" id="tellme" value="Tell me about you" /><input type="button" id="speak" value="speak"/><input type="button" id="info" value="Object Info"/><div id="test"></div>

JavaScript

var $test = $('#test');
function employee(name, position, head) {
  this.name = name || 'Manfred';
  this.dept = position || 'nothing';
  this.manager = head || 'nobody';
  this.toString = function() {
      return "Hi, I am " + this.name + 
          " and I work in the " + this.dept + " for " + head;
   };
  this.speak = function() {
      return 'Hi there!';
  };
}
employee.prototype = new employee();
var Tom = new employee("Tom", "graphics department", "you");
$('#speak').click(function(){
    $test.html(Tom.speak());
});
$('#tellme').click(function(){
    $test.html(Tom.toString());
});

employee.prototype.objectInfo = function(){
    var loop;
    for (var prop in this) {
        // Check if it's NOT a function
        if (!(this[prop] instanceof Function)) {
            loop += prop + ': ' + this[prop] + '<br />';
        }
    }
    return loop;
}
//console.log(Tom.objectInfo());
//console.log(employee, Tom);
$('#info').click(function(){
    $test.html(Tom.objectInfo());
});