|
|
JavaScript constructor Property
JavaScript Number Object
Definition and Usage
The constructor property returns a reference to the Number function that created the object.
Syntax
Example
Example
How to use the constructor property:
<script type="text/javascript">
var test=new Number();
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==Number)
{
document.write("This is a Number");
}
</script>
|
The output of the code above will be:
Try it yourself »
|
JavaScript Number Object
|
|
|