public interface JSObjectFunctions
| Type | Property and Description |
|---|---|
JSBoolean |
hasOwn
function hasOwnProperty(name) check whether a property is inherited.
|
| Modifier and Type | Method and Description |
|---|---|
JSBoolean |
hasOwnProperty()
function hasOwnProperty(name) check whether a property is inherited.
|
JSBoolean |
isPrototypeOf(JSObject o)
function isPrototypeOf(o) is an object the prototype of another?
|
JSBoolean |
propertyIsEnumerable(JSObject name)
function propertyIsEnumerable(name) will property be seen by for/in loop?
|
JSString |
toLocaleString()
function toLocaleString() return an object localized string representation.
|
java.lang.String |
toString()
function toString() define an objects string representation.
|
JSObject |
valueOf()
function valueOf() the primitive value of a specified object.
|
JSBoolean hasOwnProperty
Example
var o = new Object();
o.x = 3.14;
o.hasOwnProperty("x"); //return true; o has property x.
o.hasOwnProperty("y"); //return false; o does not have property y.
o.hasOwnProperty("toString"); //return false; o inherits toString.
java.lang.String toString()
toString in class java.lang.ObjectObject,
toLocalString(),
valueOf()JSString toLocaleString()
Object,
toString()JSObject valueOf()
Object.,
toString()JSBoolean hasOwnProperty()
Example
var o = new Object();
o.x = 3.14;
o.hasOwnProperty("x"); //return true; o has property x.
o.hasOwnProperty("y"); //return false; o does not have property y.
o.hasOwnProperty("toString"); //return false; o inherits toString.
JSBoolean isPrototypeOf(JSObject o)
Example
var o = new Object(); Object.prototype.isPrototypeOf(o); //true: o is an object. Function.prototype.isPrototypeOf(o.toString(); //return true: toString is a function. Array.prototype.isPrototypeOf([1,2,3]; //return true: [1,2,3] is an Array.
o - Any objectObjectJSBoolean propertyIsEnumerable(JSObject name)
Example
var o = new Object();
o.x = 3.14;
o.propertyIsEnumerable("x"); //return true; property x is local and enumerable.
o.propertyIsEnumerable("y"); //return false; o does not have property y.
o.propertyIsEnumerable("toString"); //return false; o inherits toString.
name - A string that contains the name of a property of object.Object,
hasOwnProperty()