Get Programming with JavaScript - Listing 5.19

Listing 5.19 - Displaying a player's information using properties

var showPlayerInfo = (playerName, playerPlace, playerHealth) => { const name = playerName; const place = `${playerName} is in ${playerPlace}`; const health = `${playerName} has health ${playerHealth}`; console.log(` ${name} ---------------------------- ${place} ${health} ---------------------------- ` ); }; const player1 = { name: "Kandra", place: "The Dungeon of Doom", health: 50 }; const player2 = { name: "Dax", place: "The Old Library", health: 40 }; showPlayerInfo(player1.name, player1.place, player1.health); showPlayerInfo(player2.name, player2.place, player2.health);