ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing

ExpertRating Home
ExpertRating Benefits
Recommend ExpertRating
Suggest More Tests
Privacy Policy
FAQ
Login
 
JavaScript Tutorial - Index
JavaScript Tutorial - Introduction to JavaScript
JavaScript Tutorial - Basic JavaScript Concepts
JavaScript Tutorial - Working with Operators and Variables
JavaScript Tutorial - How to work with Loops and Functions?
JavaScript Tutorial - How to work with Forms and Events?
JavaScript Tutorial - How to work with Objects?
JavaScript Tutorial - How to work with Browsers and Cookies?
JavaScript Tutorial - More about Objects
JavaScript Tutorial - How to validate Forms with JavaScript?
JavaScript Tutorial - Advanced Techniques in JavaScript
     

 
Online Personal Trainer Certification
Personal Trainer Certification (Spanish)
Six Sigma Certification
Find a Personal Trainer
Project Management Certification
Six Sigma Certification
Six Sigma Black Belt Certification
Master Black Belt Certification
Six Sigma Green Belt Certification
Life Coach Certification
Lean Management Certification
Lean Six Sigma Certification
First Aid Certification
CPR Certification
Yoga Certification
Aerobics Certification
Pilates Certification
Business Analyst Certification
SEO Certification
Online Business Writing Course & Certification
Makeup Artist Certification
Baby Sitting Course & Certification
Time Management Certification
Health Club Management Certification
Medical Coding Certification
Medical Billing Certification
Business Analysis Course
Master Trainer Certification
Total Quality Management Certification
Kaizen Certification
Creative Writing Certification
Event Management Certification
Test Search by Job Title
Administrative Assistant Certification
Virtual Assistant Certification
  All Online Courses
   

   
   
   
   
   
   

   
  Home > Courses, Tutorials & eBooks > JavaScript Tutorial > How to work with Objects?
 

JavaScript Tutorial - How to work with Objects?

 
Page 4 of 4
 
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

  1. The ---------- allows you to recognize objects in an HTML web page.
  2. The Topmost object in the DOM is the -----------.
  3. Objects have ---------, --------- and ---------.
  4. -------- object is the built-in JavaScript object through which mathematical calculations can be performed.
Solutions
  1. Document Object Model
  2. Navigator
  3. Properties, Methods and Events.
  4. Math

True or False

  1. DOM is only recognized by JavaScript enabled browsers.
  2. Navigator object provides information about the current browser, in which the script is executing.
  3. Object provides storage of multiple values in a single unit.
  4. It is necessary for all the objects to have Properties, Methods and Events.
Solutions
  1. True
  2. True
  3. True
  4. False
Exercise

 

 

Exercise1
  1. Find the length of a string.
  2. Replace a string with another.
  3. Display the current date and time in a browser.

 

Solution
  1. View Code       View Runtime
  2. View Code       View Runtime
  3. View Code       View Runtime

 

 
Exercise2:
If a= 10.233, then print the value of 'a' after each of the following operations :
  1. round(a)
  2. ceil(a)
  3. cos(a)
  4. floor(a)
  5. sin(a)
  6. tan(a)
Solution
  1. View Code            View Run time
  2. View Code            View Runtime
  3. View Code            View Runtime
  4. View Code            View Runtime
  5. View Code            View Runtime
  6. View Code            View Runtime
 
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.

 
       

 

 
     
Home  |  About Us  |  Privacy Policy  |  Site Map  |  FAQs  |  Contact Us
 
© ExpertRating 2015. All Rights Reserved.