why this syntax outputs this error
const Player = (name, marker) => {
this.name = name;
this.marker = marker;
};
const playerOne = new Player("Steve", "Y");
console.log(playerOne);
// TypeError: Player is not a constructor
And at the same time writing it in function declaration won't
function Player(name, marker) {
this.name = name;
this.marker = marker;
}
const playerOne = new Player("Steve", "Y");
console.log(playerOne);