Ext.data.JsonP.Object({"alternateClassNames":[],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":[],"extends":null,"uses":[],"html":"
Files
Creates an object wrapper.
\n\nThe Object constructor creates an object wrapper for the given value. If the value is null or\nundefined, it will create and return an empty object, otherwise, it will return an object of a type\nthat corresponds to the given value.
\n\nWhen called in a non-constructor context, Object behaves identically.
\n\nThe following examples store an empty Object object in o:
\n\nvar o = new Object();\n\nvar o = new Object(undefined);\n\nvar o = new Object(null);\n
\n\nThe following examples store Boolean objects in o:
\n\n// equivalent to o = new Boolean(true);\nvar o = new Object(true);\n\n// equivalent to o = new Boolean(false);\nvar o = new Object(Boolean());\n
\n\nSpecifies the function that creates an object's prototype.
\n\nReturns a reference to the Object function that created the instance's prototype. Note that the\nvalue of this property is a reference to the function itself, not a string containing the\nfunction's name, but it isn't read only (except for primitive Boolean, Number or String values: 1,\ntrue, \"read-only\").
\n\nAll objects inherit a constructor
property from their prototype
:
o = new Object // or o = {} in JavaScript 1.2\no.constructor == Object\na = new Array // or a = [] in JavaScript 1.2\na.constructor == Array\nn = new Number(3)\nn.constructor == Number\n
\n\nEven though you cannot construct most HTML objects, you can do comparisons. For example,
\n\ndocument.constructor == Document\ndocument.form3.constructor == Form\n
\n\nThe following example creates a prototype, Tree
, and an object of that type, theTree. The example then displays the constructor
property for the object theTree
.
function Tree(name) {\n this.name = name;\n}\ntheTree = new Tree(\"Redwood\");\nconsole.log(\"theTree.constructor is \" + theTree.constructor);\n
\n\nThis example displays the following output:
\n\ntheTree.constructor is function Tree(name) {\n this.name = name;\n}\n
\n\nThe following example shows how to modify constructor value of generic objects. Only true, 1 and\n\"test\" variable constructors will not be changed. This example explains that is not always so safe\nto believe in constructor function.
\n\nfunction Type(){};\nvar types = [\n new Array, [],\nnew Boolean, true,\nnew Date,\nnew Error,\nnew Function, function(){},\nMath,\nnew Number, 1,\nnew Object, {},\nnew RegExp, /(?:)/,\nnew String, \"test\"\n];\nfor(var i = 0; i < types.length; i++){\n types[i].constructor = Type;\n types[i] = [types[i].constructor, types[i] instanceof Type, types[i].toString()];\n};\nalert(types.join(\"\\n\"));\n
\nReturns a boolean indicating whether an object contains the specified property as a direct property\nof that object and not inherited through the prototype chain.
\n\nEvery object descended from Object
inherits the hasOwnProperty
method. This method can be used\nto determine whether an object has the specified property as a direct property of that object;\nunlike the in
operator, this method does not check down the object's prototype chain.
The following example determines whether the o object contains a property named prop:
\n\no = new Object();\no.prop = 'exists';\n\nfunction changeO() {\n o.newprop = o.prop;\n delete o.prop;\n}\n\no.hasOwnProperty('prop'); //returns true\nchangeO();\no.hasOwnProperty('prop'); //returns false\n
\n\nThe following example differentiates between direct properties and properties inherited through the\nprototype chain:
\n\no = new Object();\no.prop = 'exists';\no.hasOwnProperty('prop'); // returns true\no.hasOwnProperty('toString'); // returns false\no.hasOwnProperty('hasOwnProperty'); // returns false\n
\n\nThe following example shows how to iterate over the properties of an object without executing on\ninherit properties.
\n\nvar buz = {\n fog: 'stack'\n};\n\nfor (var name in buz) {\n if (buz.hasOwnProperty(name)) {\n alert(\"this is fog (\" + name + \") for sure. Value: \" + buz[name]);\n }\n else {\n alert(name); // toString or something else\n }\n}\n
\nThe name of the property to test.
\nReturns true if object contains specified property; else\nreturns false.
\nReturns a boolean indication whether the specified object is in the prototype chain of the object\nthis method is called upon.
\n\nisPrototypeOf
allows you to check whether or not an object exists within another object's\nprototype chain.
For example, consider the following prototype chain:
\n\nfunction Fee() {\n // . . .\n}\n\nfunction Fi() {\n // . . .\n}\nFi.prototype = new Fee();\n\nfunction Fo() {\n // . . .\n}\nFo.prototype = new Fi();\n\nfunction Fum() {\n // . . .\n}\nFum.prototype = new Fo();\n
\n\nLater on down the road, if you instantiate Fum
and need to check if Fi
's prototype exists\nwithin the Fum
prototype chain, you could do this:
var fum = new Fum();\n. . .\n\nif (Fi.prototype.isPrototypeOf(fum)) {\n// do something safe\n}\n
\n\nThis, along with the instanceof
operator particularly comes in handy if you have code that can\nonly function when dealing with objects descended from a specific prototype chain, e.g., to\nguarantee that certain methods or properties will be present on that object.
an object to be tested against each link in the prototype chain of the\nobject argument
\nthe object whose prototype chain will be searched
\nReturns true if object is a prototype and false if not.
\nReturns a boolean indicating if the internal ECMAScript DontEnum attribute is set.
\n\nEvery object has a propertyIsEnumerable
method. This method can determine whether the specified\nproperty in an object can be enumerated by a for...in
loop, with the exception of properties\ninherited through the prototype chain. If the object does not have the specified property, this\nmethod returns false.
The following example shows the use of propertyIsEnumerable
on objects and arrays:
var o = {};\nvar a = [];\no.prop = 'is enumerable';\na[0] = 'is enumerable';\n\no.propertyIsEnumerable('prop'); // returns true\na.propertyIsEnumerable(0); // returns true\n
\n\nThe following example demonstrates the enumerability of user-defined versus built-in properties:
\n\nvar a = ['is enumerable'];\n\na.propertyIsEnumerable(0); // returns true\na.propertyIsEnumerable('length'); // returns false\n\nMath.propertyIsEnumerable('random'); // returns false\nthis.propertyIsEnumerable('Math'); // returns false\n
\n\nDirect versus inherited properties
\n\nvar a = [];\na.propertyIsEnumerable('constructor'); // returns false\n\nfunction firstConstructor()\n{\n this.property = 'is not enumerable';\n}\nfirstConstructor.prototype.firstMethod = function () {};\n\nfunction secondConstructor()\n{\n this.method = function method() { return 'is enumerable'; };\n}\n\nsecondConstructor.prototype = new firstConstructor;\nsecondConstructor.prototype.constructor = secondConstructor;\n\nvar o = new secondConstructor();\no.arbitraryProperty = 'is enumerable';\n\no.propertyIsEnumerable('arbitraryProperty'); // returns true\no.propertyIsEnumerable('method'); // returns true\no.propertyIsEnumerable('property'); // returns false\n\no.property = 'is enumerable';\n\no.propertyIsEnumerable('property'); // returns true\n\n// These return false as they are on the prototype which\n// propertyIsEnumerable does not consider (even though the last two\n// are iteratable with for-in)\no.propertyIsEnumerable('prototype'); // returns false (as of JS 1.8.1/FF3.6)\no.propertyIsEnumerable('constructor'); // returns false\no.propertyIsEnumerable('firstMethod'); // returns false\n
\nThe name of the property to test.
\nIf the object does not have the specified property, this\nmethod returns false.
\nReturns a string representing the object. This method is meant to be overridden by derived objects\nfor locale-specific purposes.
\n\nObject
's toLocaleString
returns the result of calling toString
.
This function is provided to give objects a generic toLocaleString
method, even though not all\nmay use it. Currently, only Array
, Number
, and Date
override toLocaleString
.
Object represented as a string.
\nReturns a string representation of the object.
\n\nEvery object has a toString()
method that is automatically called when the object is to be\nrepresented as a text value or when an object is referred to in a manner in which a string is\nexpected. By default, the toString()
method is inherited by every object descended from Object
.\nIf this method is not overridden in a custom object, toString()
returns \"[object type]\", where\ntype
is the object type. The following code illustrates this:
var o = new Object();\no.toString(); // returns [object Object]\n
\n\nYou can create a function to be called in place of the default toString()
method. The\ntoString()
method takes no arguments and should return a string. The toString()
method you\ncreate can be any value you want, but it will be most useful if it carries information about the\nobject.
The following code defines the Dog
object type and creates theDog
, an object of type Dog
:
function Dog(name,breed,color,sex) {\n this.name=name;\n this.breed=breed;\n this.color=color;\n this.sex=sex;\n}\n\ntheDog = new Dog(\"Gabby\",\"Lab\",\"chocolate\",\"female\");\n
\n\nIf you call the toString()
method on this custom object, it returns the default value inherited\nfrom Object
:
theDog.toString(); //returns [object Object]\n
\n\nThe following code creates and assigns dogToString()
to override the default toString()
method.\nThis function generates a string containing the name, breed, color, and sex of the object, in the\nform \"property = value;\"
.
Dog.prototype.toString = function dogToString() {\n var ret = \"Dog \" + this.name + \" is a \" + this.sex + \" \" + this.color + \" \" + this.breed;\n return ret;\n}\n
\n\nWith the preceding code in place, any time theDog is used in a string context, JavaScript\nautomatically calls the dogToString()
function, which returns the following string:
Dog Gabby is a female chocolate Lab\n
\n\ntoString()
can be used with every object and allows you to get its class. To use the\nObject.prototype.toString()
with every object, you need to call Function.prototype.call()
or\nFunction.prototype.apply()
on it, passing the object you want to inspect as the first parameter\ncalled thisArg
.
var toString = Object.prototype.toString;\n\ntoString.call(new Date); // [object Date]\ntoString.call(new String); // [object String]\ntoString.call(Math); // [object Math]\n
\nObject represented as a string.
\nReturns the primitive value of the specified object.
\n\nJavaScript calls the valueOf
method to convert an object to a primitive value. You rarely need to\ninvoke the valueOf
method yourself; JavaScript automatically invokes it when encountering an\nobject where a primitive value is expected.
By default, the valueOf
method is inherited by every object descended from Object
. Every built-\nin core object overrides this method to return an appropriate value. If an object has no primitive\nvalue, valueOf
returns the object itself, which is displayed as:
[object Object]\n
\n\nYou can use valueOf
within your own code to convert a built-in object into a primitive value.\nWhen you create a custom object, you can override Object.valueOf
to call a custom method instead\nof the default Object
method.
You can create a function to be called in place of the default valueOf
method. Your function must\ntake no arguments.
Suppose you have an object type myNumberType
and you want to create a valueOf
method for it.\nThe following code assigns a user-defined function to the object's valueOf method:
myNumberType.prototype.valueOf = new Function(functionText)\n
\n\nWith the preceding code in place, any time an object of type myNumberType
is used in a context\nwhere it is to be represented as a primitive value, JavaScript automatically calls the function\ndefined in the preceding code.
An object's valueOf
method is usually invoked by JavaScript, but you can invoke it yourself as\nfollows:
myNumber.valueOf()\n
\n\nNote: Objects in string contexts convert via the toString
method, which is different from\nString
objects converting to string primitives using valueOf
. All objects have a string\nconversion, if only \"[object type]\"
. But many objects do not convert to number, boolean, or\nfunction.
Returns value of the object or the object itself.
\nCreates a new object with the specified prototype object and properties.
\n\nBelow is an example of how to use Object.create
to achieve\nclassical inheritance, this is for single inheritance, which is all\nthat Javascript supports.
//Shape - superclass\nfunction Shape() {\n this.x = 0;\n this.y = 0;\n}\n\nShape.prototype.move = function(x, y) {\n this.x += x;\n this.y += y;\n console.info(\"Shape moved.\");\n};\n\n// Rectangle - subclass\nfunction Rectangle() {\n Shape.call(this); //call super constructor.\n}\n\nRectangle.prototype = Object.create(Shape.prototype);\n\nvar rect = new Rectangle();\n\nrect instanceof Rectangle //true.\nrect instanceof Shape //true.\n\nrect.move(); //Outputs, \"Shape moved.\"\n
\n\nIf you wish to inherit from multiple objects, then mixins are a possibility.
\n\nfunction MyClass() {\n SuperClass.call(this);\n OtherSuperClass.call(this);\n}\n\nMyClass.prototype = Object.create(SuperClass.prototype); //inherit\nmixin(MyClass.prototype, OtherSuperClass.prototype); //mixin\n\nMyClass.prototype.myMethod = function() {\n // do a thing\n};\n
\n\nThe mixin function would copy the functions from the superclass\nprototype to the subclass prototype, the mixin function needs to be\nsupplied by the user.
\n\npropertiesObject
argument with Object.createvar o;\n\n// create an object with null as prototype\no = Object.create(null);\n\n\no = {};\n// is equivalent to:\no = Object.create(Object.prototype);\n\n\n// Example where we create an object with a couple of sample properties.\n// (Note that the second parameter maps keys to *property descriptors*.)\no = Object.create(Object.prototype, {\n // foo is a regular \"value property\"\n foo: { writable:true, configurable:true, value: \"hello\" },\n // bar is a getter-and-setter (accessor) property\n bar: {\n configurable: false,\n get: function() { return 10 },\n set: function(value) { console.log(\"Setting `o.bar` to\", value) }\n}})\n\n\nfunction Constructor(){}\no = new Constructor();\n// is equivalent to:\no = Object.create(Constructor.prototype);\n// Of course, if there is actual initialization code in the Constructor function, the Object.create cannot reflect it\n\n\n// create a new object whose prototype is a new, empty object\n// and a adding single property 'p', with value 42\no = Object.create({}, { p: { value: 42 } })\n\n// by default properties ARE NOT writable, enumerable or configurable:\no.p = 24\no.p\n//42\n\no.q = 12\nfor (var prop in o) {\n console.log(prop)\n}\n//\"q\"\n\ndelete o.p\n//false\n\n//to specify an ES3 property\no2 = Object.create({}, { p: { value: 42, writable: true, enumerable: true, configurable: true } });\n
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object which should be the prototype of\nthe newly-created object.
\n\nThrows a TypeError
exception if the proto
parameter isn't null or\nan object.
If specified and not undefined,\nan object whose enumerable own properties (that is, those\nproperties defined upon itself and not enumerable properties along\nits prototype chain) specify property descriptors to be added to\nthe newly-created object, with the corresponding property names.
\nthe newly created object.
\nDefines new or modifies existing properties directly on an object,\nreturning the object.
\n\nIn essence, it defines all properties corresponding to the\nenumerable own properties of props on the object.
\n\nObject.defineProperties(obj, {\n \"property1\": {\n value: true,\n writable: true\n },\n \"property2\": {\n value: \"Hello\",\n writable: false\n }\n // etc. etc.\n});\n
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nDefines a new property directly on an object, or modifies an\nexisting property on an object, and returns the object.
\n\nThis method allows precise addition to or modification of a\nproperty on an object. Normal property addition through assignment\ncreates properties which show up during property enumeration\n(for...in loop or keys method), whose values may be\nchanged, and which may be deleted. This method allows these extra\ndetails to be changed from their defaults.
\n\nProperty descriptors present in objects come in two main flavors:\ndata descriptors and accessor descriptors. A data descriptor is a\nproperty that has a value, which may or may not be writable. An\naccessor descriptor is a property described by a getter-setter pair\nof functions. A descriptor must be one of these two flavors; it\ncannot be both.
\n\nBoth data and accessor descriptor is an object with the following\noptional keys:
\n\nconfigurable True if and only if the type of this property\ndescriptor may be changed and if the property may be deleted from\nthe corresponding object. Defaults to false.
enumerable True if and only if this property shows up during\nenumeration of the properties on the corresponding\nobject. Defaults to false.
A data descriptor is an object with the following optional keys:
\n\nvalue The value associated with the property. Can be any\nvalid JavaScript value (number, object, function, etc) Defaults\nto undefined.
writable True if and only if the value associated with the\nproperty may be changed with an assignment operator. Defaults to\nfalse.
An accessor descriptor is an object with the following optional\nkeys:
\n\nget A function which serves as a getter for the property, or\nundefined if there is no getter. The function return will be used\nas the value of property. Defaults to undefined.
set A function which serves as a setter for the property, or\nundefined if there is no setter. The function will receive as\nonly argument the new value being assigned to the\nproperty. Defaults to undefined.
Bear in mind that these options are not necessarily own properties\nso, if inherited, will be considered too. In order to ensure these\ndefaults are preserved you might freeze the Object.prototype\nupfront, specify all options explicitly, or point to null as\nproto property.
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nFreezes an object: that is, prevents new properties from being\nadded to it; prevents existing properties from being removed; and\nprevents existing properties, or their enumerability,\nconfigurability, or writability, from being changed. In essence the\nobject is made effectively immutable. The method returns the object\nbeing frozen.
\n\nNothing can be added to or removed from the properties set of a\nfrozen object. Any attempt to do so will fail, either silently or\nby throwing a TypeError exception (most commonly, but not\nexclusively, when in strict mode).
\n\nValues cannot be changed for data properties. Accessor properties\n(getters and setters) work the same (and still give the illusion\nthat you are changing the value). Note that values that are objects\ncan still be modified, unless they are also frozen.
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object to freeze.
\nReturns a property descriptor for an own property (that is, one\ndirectly present on an object, not present by dint of being along\nan object's prototype chain) of a given object.
\n\nThis method permits examination of the precise description of a\nproperty. A property in JavaScript consists of a string-valued name\nand a property descriptor. Further information about property\ndescriptor types and their attributes can be found in\ndefineProperty.
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object in which to look for the property.
\nThe name of the property whose description is\nto be retrieved.
\n\nA property descriptor is a record with some of the following\nattributes:
\n\nvalue The value associated with the property (data\ndescriptors only).
writable True if and only if the value associated with\nthe property may be changed (data descriptors only).
get A function which serves as a getter for the property,\n or undefined if there is no getter (accessor descriptors only).
set A function which serves as a setter for the property,\nor undefined if there is no setter (accessor descriptors only).
configurable true if and only if the type of this property\ndescriptor may be changed and if the property may be deleted\nfrom the corresponding object.
enumerable true if and only if this property shows up\nduring enumeration of the properties on the corresponding object.
Value of the property descriptor.
\nReturns an array of all properties (enumerable or not) found\ndirectly upon a given object.
\n\nRreturns an array whose elements are strings corresponding to the\nenumerable and non-enumerable properties found directly upon\nobj. The ordering of the enumerable properties in the array is\nconsistent with the ordering exposed by a for...in loop (or by\nkeys) over the properties of the object. The\nordering of the non-enumerable properties in the array, and among\nthe enumerable properties, is not defined.
\n\nvar arr = [\"a\", \"b\", \"c\"];\nprint(Object.getOwnPropertyNames(arr).sort()); // prints \"0,1,2,length\"\n\n// Array-like object\nvar obj = { 0: \"a\", 1: \"b\", 2: \"c\"};\nprint(Object.getOwnPropertyNames(obj).sort()); // prints \"0,1,2\"\n\n// Printing property names and values using Array.forEach\nObject.getOwnPropertyNames(obj).forEach(function(val, idx, array) {\n print(val + \" -> \" + obj[val]);\n});\n// prints\n// 0 -> a\n// 1 -> b\n// 2 -> c\n\n// non-enumerable property\nvar my_obj = Object.create({}, { getFoo: { value: function() { return this.foo; }, enumerable: false } });\nmy_obj.foo = 1;\n\nprint(Object.getOwnPropertyNames(my_obj).sort()); // prints \"foo, getFoo\"\n
\n\nIf you want only the enumerable properties, see keys\nor use a for...in loop (although note that this will return\nenumerable properties not found directly upon that object but also\nalong the prototype chain for the object unless the latter is\nfiltered with hasOwnProperty).
\n\nItems on the prototype chain are not listed:
\n\nfunction ParentClass () {\n}\nParentClass.prototype.inheritedMethod = function () {\n};\n\nfunction ChildClass () {\n this.prop = 5;\n this.method = function () {};\n}\nChildClass.prototype = new ParentClass;\nChildClass.prototype.prototypeMethod = function () {\n};\n\nalert(\n Object.getOwnPropertyNames(\n new ChildClass() // [\"prop\", \"method\"]\n )\n)\n
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object whose enumerable and non-enumerable\nown properties are to be returned.
\nArray of property names.
\nReturns the prototype (i.e. the internal [[Prototype]]
) of the\nspecified object.
NOTE: This method is part of the ECMAScript 5 standard.
\nThe object whose prototype is to be returned.\nThrows a TypeError exception if this parameter isn't an Object.
\nthe prototype
\nDetermines if an object is extensible (whether it can have new\nproperties added to it).
\n\nObjects are extensible by default: they can have new properties\nadded to them, and can be modified. An object can be marked as\nnon-extensible using preventExtensions,\nseal, or freeze.
\n\n// New objects are extensible.\nvar empty = {};\nassert(Object.isExtensible(empty) === true);\n\n// ...but that can be changed.\nObject.preventExtensions(empty);\nassert(Object.isExtensible(empty) === false);\n\n// Sealed objects are by definition non-extensible.\nvar sealed = Object.seal({});\nassert(Object.isExtensible(sealed) === false);\n\n// Frozen objects are also by definition non-extensible.\nvar frozen = Object.freeze({});\nassert(Object.isExtensible(frozen) === false);\n
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object which should be checked.
\nTrue when object is extensible.
\nDetermines if an object is frozen.
\n\nAn object is frozen if and only if it is not extensible, all its\nproperties are non-configurable, and all its data properties (that\nis, properties which are not accessor properties with getter or\nsetter components) are non-writable.
\n\n// A new object is extensible, so it is not frozen.\nassert(Object.isFrozen({}) === false);\n\n// An empty object which is not extensible is vacuously frozen.\nvar vacuouslyFrozen = Object.preventExtensions({});\nassert(Object.isFrozen(vacuouslyFrozen) === true);\n\n// A new object with one property is also extensible, ergo not frozen.\nvar oneProp = { p: 42 };\nassert(Object.isFrozen(oneProp) === false);\n\n// Preventing extensions to the object still doesn't make it frozen,\n// because the property is still configurable (and writable).\nObject.preventExtensions(oneProp);\nassert(Object.isFrozen(oneProp) === false);\n\n// ...but then deleting that property makes the object vacuously frozen.\ndelete oneProp.p;\nassert(Object.isFrozen(oneProp) === true);\n\n// A non-extensible object with a non-writable but still configurable property is not frozen.\nvar nonWritable = { e: \"plep\" };\nObject.preventExtensions(nonWritable);\nObject.defineProperty(nonWritable, \"e\", { writable: false }); // make non-writable\nassert(Object.isFrozen(nonWritable) === false);\n\n// Changing that property to non-configurable then makes the object frozen.\nObject.defineProperty(nonWritable, \"e\", { configurable: false }); // make non-configurable\nassert(Object.isFrozen(nonWritable) === true);\n\n// A non-extensible object with a non-configurable but still writable property also isn't frozen.\nvar nonConfigurable = { release: \"the kraken!\" };\nObject.preventExtensions(nonConfigurable);\nObject.defineProperty(nonConfigurable, \"release\", { configurable: false });\nassert(Object.isFrozen(nonConfigurable) === false);\n\n// Changing that property to non-writable then makes the object frozen.\nObject.defineProperty(nonConfigurable, \"release\", { writable: false });\nassert(Object.isFrozen(nonConfigurable) === true);\n\n// A non-extensible object with a configurable accessor property isn't frozen.\nvar accessor = { get food() { return \"yum\"; } };\nObject.preventExtensions(accessor);\nassert(Object.isFrozen(accessor) === false);\n\n// ...but make that property non-configurable and it becomes frozen.\nObject.defineProperty(accessor, \"food\", { configurable: false });\nassert(Object.isFrozen(accessor) === true);\n\n// But the easiest way for an object to be frozen is if Object.freeze has been called on it.\nvar frozen = { 1: 81 };\nassert(Object.isFrozen(frozen) === false);\nObject.freeze(frozen);\nassert(Object.isFrozen(frozen) === true);\n\n// By definition, a frozen object is non-extensible.\nassert(Object.isExtensible(frozen) === false);\n\n// Also by definition, a frozen object is sealed.\nassert(Object.isSealed(frozen) === true);\n
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object which should be checked.
\nTrue if the object is frozen, otherwise false.
\nDetermines if an object is sealed.
\n\nAn object is sealed if it is non-extensible and if all its\nproperties are non-configurable and therefore not removable (but\nnot necessarily non-writable).
\n\n// Objects aren't sealed by default.\nvar empty = {};\nassert(Object.isSealed(empty) === false);\n\n// If you make an empty object non-extensible, it is vacuously sealed.\nObject.preventExtensions(empty);\nassert(Object.isSealed(empty) === true);\n\n// The same is not true of a non-empty object, unless its properties are all non-configurable.\nvar hasProp = { fee: \"fie foe fum\" };\nObject.preventExtensions(hasProp);\nassert(Object.isSealed(hasProp) === false);\n\n// But make them all non-configurable and the object becomes sealed.\nObject.defineProperty(hasProp, \"fee\", { configurable: false });\nassert(Object.isSealed(hasProp) === true);\n\n// The easiest way to seal an object, of course, is Object.seal.\nvar sealed = {};\nObject.seal(sealed);\nassert(Object.isSealed(sealed) === true);\n\n// A sealed object is, by definition, non-extensible.\nassert(Object.isExtensible(sealed) === false);\n\n// A sealed object might be frozen, but it doesn't have to be.\nassert(Object.isFrozen(sealed) === true); // all properties also non-writable\n\nvar s2 = Object.seal({ p: 3 });\nassert(Object.isFrozen(s2) === false); // \"p\" is still writable\n\nvar s3 = Object.seal({ get p() { return 0; } });\nassert(Object.isFrozen(s3) === true); // only configurability matters for accessor properties\n
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object which should be checked.
\nTrue if the object is sealed, otherwise false.
\nReturns an array of a given object's own enumerable properties, in\nthe same order as that provided by a for-in loop (the difference\nbeing that a for-in loop enumerates properties in the prototype\nchain as well).
\n\nReturns an array whose elements are strings corresponding to the\nenumerable properties found directly upon object. The ordering of\nthe properties is the same as that given by looping over the\nproperties of the object manually.
\n\nvar arr = [\"a\", \"b\", \"c\"];\nalert(Object.keys(arr)); // will alert \"0,1,2\"\n\n// array like object\nvar obj = { 0 : \"a\", 1 : \"b\", 2 : \"c\"};\nalert(Object.keys(obj)); // will alert \"0,1,2\"\n\n// getFoo is property which isn't enumerable\nvar my_obj = Object.create({}, { getFoo : { value : function () { return this.foo } } });\nmy_obj.foo = 1;\n\nalert(Object.keys(my_obj)); // will alert only foo\n
\n\nIf you want all properties, even the not enumerable, see\ngetOwnPropertyNames.
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object whose enumerable own properties are\nto be returned.
\nArray of property names.
\nPrevents new properties from ever being added to an object\n(i.e. prevents future extensions to the object).
\n\nAn object is extensible if new properties can be added to it.\npreventExtensions
marks an object as no longer extensible, so that\nit will never have properties beyond the ones it had at the time it\nwas marked as non-extensible. Note that the properties of a\nnon-extensible object, in general, may still be deleted. Attempting\nto add new properties to a non-extensible object will fail, either\nsilently or by throwing a TypeError (most commonly, but not\nexclusively, when in strict mode).
It only prevents addition of own properties. Properties can still\nbe added to the object prototype.
\n\nIf there is a way to turn an extensible object to a non-extensible\none, there is no way to do the opposite in ECMAScript 5
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object which should be made non-extensible.
\nSeals an object, preventing new properties from being added to it\nand marking all existing properties as non-configurable. Values of\npresent properties can still be changed as long as they are\nwritable.
\n\nBy default, objects are extensible (new properties can be added to\nthem). Sealing an object prevents new properties from being added\nand marks all existing properties as non-configurable. This has the\neffect of making the set of properties on the object fixed and\nimmutable. Making all properties non-configurable also prevents\nthem from being converted from data properties to accessor\nproperties and vice versa, but it does not prevent the values of\ndata properties from being changed. Attempting to delete or add\nproperties to a sealed object, or to convert a data property to\naccessor or vice versa, will fail, either silently or by throwing a\nTypeError (most commonly, although not exclusively, when in strict\nmode code).
\n\nThe prototype chain remains untouched.
\n\nNOTE: This method is part of the ECMAScript 5 standard.
\nThe object which should be sealed.
\n