I want function to be available on a object, but I don't it to be visible if if I console.log it or send it to another function.
var obj = function() {
this.name = 'Bob';
this.age = 23;
}
obj.prototype.say = function() {
console.log(this.name, this.age, 'thats me..');
}
var pers = new obj();
console.log(pers); // { name: 'Bob', age: 23 }
pers.say(); // Bob 23 thats me..
Would this be good for solution and good practice for that? Or is it a better way to accomplish this in javascript?