| |
Date Object
The date object enables you to define an object that contains information about a particular date and provides a set of methods to work with that information.
Methods of Date Object
| Methods |
Description |
| getDate( ) |
This method returns the day of the month as an integer, from 1 to 31. |
| setDate( ) |
It sets the day of the month based on an integer value, from 1 to 31. |
| getHours( ) |
It returns the hours as an integer, from 0 to 23. |
| setHours( ) |
This method sets the hours based on an argument, from 0 to 23. |
| getTime( ) |
It returns the number of milliseconds since 1 January 1970 |
| setTime( ) |
It sets the time based on an argument representing the number of milliseconds since 1 January 1970 |
| |
| |
| Summary |
| |
In this chapter you have learnt:
- Objects recognized by JavaScript enabled browsers.
- What are objects and how objects are used to store values.
- Methods for accessing object's properties, events and methods.
- Performing mathematical calculations using math object.
- Manipulating text through string object.
|
| |
| |
| Review Questions |
| |
Fill in the Blanks
- The ---------- allows you to recognize objects in an HTML web page.
- The Topmost object in the DOM is the -----------.
- Objects have ---------, --------- and ---------.
- -------- object is the built-in JavaScript object through which mathematical calculations can be performed.
Solutions
- Document Object Model
- Navigator
- Properties, Methods and Events.
- Math
True or False
- DOM is only recognized by JavaScript enabled browsers.
- Navigator object provides information about the current browser, in which the script is executing.
- Object provides storage of multiple values in a single unit.
- It is necessary for all the objects to have Properties, Methods and Events.
Solutions
- True
- True
- True
- False
|
| |
| What's Next |
The next chapter will acquaint you with the concepts of JavaScript's navigator object and cookies. The chapter will further elucidate about browser detection and creation and deletion of cookies.
Hop over to the next chapter to get the close-up of navigator object and cookies.
|
| |
|
|