Why am I getting the following error: `SyntaxError: Unexpected identifier`?


#1

Question

Why am I getting the following error: SyntaxError: Unexpected identifier?

Answer

Check your formatting and curly braces. Make sure your getters, setters, and methods are contained within your class, within the curly braces. If they are outside of your class, they will be out of scope:

	

class className {
	constructor(arguments) {
// properties
	}

// getters here
		
// setters here
		
// methods here
	
} // closing curly brace