Date constructor property with example in JavaScript

JavaScript Date constructor property: Here, we are going to learn about the constructor property of Date class in JavaScript.
Submitted by IncludeHelp, on March 04, 2019

JavaScript Date constructor property

Date constructor property is used to get details of the Date's class constructor function. It does not take any parameter and returns the Date constructor property.

Date class constructor function can be printed using constructor property.

Syntax:

    var dt = new Date();
    dt.constructor ;

Examples:

    Input:
    var dt = new Date();
    dt.constructor ;
    
    Output:
    function Date() { [native code] }

JavaScript code to get the Date class constructor details

<html>
<head><title>JavaScipt Example</title></head>

<body>
<script>
	var dt = new Date();
	document.write("constructor is: " + dt.constructor + "<br>");
</script>
</body>
</html>

Output

constructor is: function Date() { [native code] }

JavaScript Date Object Methods »





Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.