You don't have a var/let/const in front of classInstance so it's a global window.classInstance not the closure you think it is. It's getting overwritten etc.
'use strict' can be your friend :)
Ah shit, why is it always the let var const thing that always trips me the fuck up?? But, how do I use strict mode? Is there any rule about where I start using strict mode? Also, tysm
let var const
If you stick the string
as the first line of a file - it's in strict mode and it should tell you that you are assigning to a global without defining it.
Other choice is use a linter like eslint can help in these circumstances.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.