<!DOCTYPE html>
<html>
  <body>
    <script>
      // Allows Plunker to display logs in preview panel 
      // for better in-browser experience
      var originalConsoleLog = console.log
      console.log = function () {
        originalConsoleLog.apply(console, arguments)
        var args = Array.prototype.slice.call(arguments);
        var stringifiedArgs = args.join(' ') + '\n';
        var newDiv = document.createElement("div"); 
        var newContent = document.createTextNode(stringifiedArgs); 
        newDiv.appendChild(newContent);
        document.body.appendChild(newDiv)
        
        document.querySelector('div').style['fontFamily'] = 'monospace';
        document.querySelector('div').style['fontSize'] = '1.5em';
      };
    </script>
    <script src="script.js"></script>
  </body>

</html>

const playerFactory = ({name = 'Default name', health = 100}) => ({
    name, health,
    reportStatus() {
        return console.log(`${this.name} is at ${this.health}%.`);
    }
})

const playerTwo = playerFactory({name: 'Mike Tyson'});

console.log(playerTwo.reportStatus())

/** 
class Player {
    constructor({name = 'Default name', health = 100}) {
        this.name = name;
        this.health = health;
    }
    reportStatus() {
        return console.log(`${this.name} is at ${this.health}%.`)
    }
}

const playerOne = new Player({name: 'John smith'});

console.log(playerOne.reportStatus());
*/