I've found similar questions, but none that answer this explicitly, so I hope someone can help clear this up for me.
In regards to constructor functions, I am trying to figure if variables and functions are, by default, public or private.
For example, I have this sample constructor with these properties:
function Obj() {
this.type = 'object';
this.questions = 27;
this.print = function() {
console.log('hello world');
}
}
I can call these properties as such:
var box = new Obj();
box.type; // 'object'
box.print(); // 'hello world'
It seems to me like both functions and variables are public by default. Is that right? Or, if functions inside constructors are private... can they only take private variables as parameters?
Thank you.