Max said:
Thanks VK,
It is the way.
I just make a function with an object as the argument./* function ({})
{}*/ And the object has some properties that have default values.
This object should not have any enumerable properties, unless some fool
augmented the Object.prototype object.
and when the parameter do not have all the properties that defined the
default argument object, the missing properties would take the default
values.
The for..in operation will yield all properties of the object, whether
they are inherited or not.
The obvious solution is to use a prototype. That requires a user-defined
constructor:
function MyObject()
{
}
An associated prototype object:
MyObject.prototype = {
constructor: MyObject,
a: "defaultA",
b: "defaultB",
c: "defaultC"
};
And a constructor call:
var o = new MyObject();
If the properties of the constructed object are not set in the first place
or they are subject to a `delete' operation, the object will inherit the
properties from its prototype object through the prototype chain, and so the
default values.
PointedEars