The startApp function assigns to the constructor (the startApp function) - it's a property of the class, not a property of an instance. If you want to check the PACKAGE and PATH, check the properties of the constructor (either a.constructor or System.startApp):
var System = {
startApp:function(package) {
System.startApp.PACKAGE = package;
System.startApp.PATH = "@APP:/" + package;
},
};
var a = new System.startApp("Mr. T.");
console.log(a.constructor.PACKAGE + ", " + a.constructor.PATH);
Note that the var a will only be tied to anything useful if there are prototype functions on System.startApp, for example:
var System = {
startApp:function(package) {
System.startApp.PACKAGE = package;
System.startApp.PATH = "@APP:/" + package;
},
};
System.startApp.prototype.doSomething = () => {
console.log('doing something');
};
var a = new System.startApp("Mr. T.");
console.log(a.constructor.PACKAGE + ", " + a.constructor.PATH);
a.doSomething();
If you don't have that, it doesn't make sense for startApp to be called as a constructor, nor does it make much sense to assign properties to the function.
If you want every instance to have separate properties, then assign to properties of this:
var System = {
startApp:function(package) {
this.PACKAGE = package;
this.PATH = "@APP:/" + package;
},
};
var a = new System.startApp("Mr. T.");
console.log(a.PACKAGE + ", " + a.PATH);