let firstPlayer = new Object();
firstPlayer.name = 'Player 1';
firstPlayer.level = 3;
firstPlayer.inventory = ['a half-eaten cracker', 'some pocket lint', 'a flimsy tree branch'];
firstPlayer.description = 'Don't mention Player 2 around them, they'll get angry...';
firstPlayer.checkLevel = function() {
console.log(`${this.name} is currently... Level ${this.level}!`);
}
firstPlayer.checkLevel();
let secondPlayer = {
name: 'Player 2',
level: 20,
inventory: ['a health potion', 'a sack of gold coins', 'a sturdy steel blade'],
description: 'Better than Player 1 in every way possible.',
checkLevel: function() {
console.log(`${this.name} is currently... Level ${this.level}!`);
}
}
secondPlayer.checkLevel();