If the function is called in the global scope, then this means a reference to the browser object window That is, the context object is the window object.
When the function is first called, the numbers property is added to the window object.
if(this.numbers === undefined) this.numbers = []; ^^^^^^^^^^^^^^^^^^^^^^^^^^
And also with each call, the windows showNumbers property is showNumbers
this.showNumbers = function() { console.log(this.numbers); }
In these calls
OneInstance(1).showNumbers(); OneInstance(2).showNumbers();
since the OneInstance function returns this , it returns a reference to the window object, and its showNumbers property is showNumbers
You could call this function in the context of an arbitrary object, adding this function as a property of an object, and then calling it in the context of this object would mean this object.