Reputation: 1457
I've logged a Javascript Object to find a property. But it appears some of them are faded.
Is that private propeties ?
Upvotes: 0
Views: 496
Reputation: 4116
Not private, just non-enumerable. It means if you iterate over your object with a for..in
loop, the loop will skip them. You can still access them directly by name.
Properties you add to the object are enumerable by default. You can make them non-enumerable by calling e.g. Object.defineProperty(obj, 'ytd_sale', { enumerable: false });
Upvotes: 1