|
|
JavaScript constructor Property
JavaScript String Object
Definition and Usage
The constructor property is a reference to the function that created the object.
Syntax
Example
Example
How we can use the constructor property:
<script type="text/javascript">
var test=new String();
if (test.constructor==Array)
{
document.write("This is an Array");
}
if (test.constructor==Boolean)
{
document.write("This is a Boolean");
}
if (test.constructor==Date)
{
document.write("This is a Date");
}
if (test.constructor==String)
{
document.write("This is a String");
}
</script>
|
The output of the code above will be:
Try it yourself »
|
JavaScript String Object
The Creators of XMLSpy are Pleased to Announce
|
|
|