declare any field after you create object, even if they are undefined inside you class
there is no wrong, i just curious about undefined field work like that do you have any reference about those thing?
Javascript objects are dynamic, which means you can add properties to it without having to define them beforehand. And Class are just Functions, which are a special kind of Object. It can be confusing if you're just getting into it from a language like Java, but class is just syntax sugar, OOP in JS is still based on prototype
Обсуждают сегодня