Back to Forum
having trouble creating a character
aaliyah403 posted 4 years ago

I followed the code exactly but I keep getting the same error

"Uncaught SyntaxError: Identifier 'player' has already been declared"

I've tried everything and nothing seems to be working

chris's profile photo
chris posted 4 years ago
Best Reply

Double check that you only have one instance of a player const or let. It might be located in a different file if you're pulling in multiple script tags.

As long as there's only one const player = new Player() your error will go away.

If you need to reset it somewhere else separately, define it as a let and set it without a declaration:

let player = new Player()
player = new Player()

Want to participate?

Create a free Chris Courses account to begin

Providing the lift to launch your development career

© 2026 Chris Courses. All rights reserved.