i have this project where i would like to merge a "function" object (in contrast to the JSON object - an object literal) with an existing object. i would want to get the "publicly visible" properties. however, when i do a for in loop, they don't show up. they don't trigger the console.log() inside. how do i get them?
//obj passed to extend() by external caller
//this is what obj it looked like when i console.log()'ed it
obj = function() {
//skip these private ones
var imPrivate = 'i should not be included';
function imGetter() {}
//i want these guys below:
this.getter = imGetter;
this.imPublic = "i should be included";
}
function extend(obj){
console.log('i can see here');
for (var key in obj) {
console.log('you cannot see here');
}
//...more of our code here
}
newoperator before any of those properties were set.objhere is just to display what i was passed to the loop (as shown in the console). the loop is part of a function we namedextend, which is irrelevant to the question :)