The cityManager object is in the global namespace. Make cityManager a parameter for the cityElement's constructor and refer to the cityElement instance's this.cityManager property instead.