number isn't a variable, it's a property. You don't have to declare properties (in fact, until the class fields proposal progresses, you can't declare properties; there's no property declaration syntax). Variables are storage outside of an object. A property is storage within an object.
If you're wondering how
undefined, not an error.