EXERCISES


1:

Create a circle object and a method that will calculate its circumference.

2:

Write a function that will create a clock object.

  1. It will have three properties: seconds, minutes , and hours .

  2. Write two methods : setTime() to set the current time and displayTime() to display the time.

  3. The user will be prompted to select either a.m., p.m., or military time. The value he chooses will be passed as an argument to the display() method.

  4. The output will be either

    14:10:26 or 2:10:26

    depending on what argument was passed to the display() method.




JavaScript by Example
JavaScript by Example (2nd Edition)
ISBN: 0137054890
EAN: 2147483647
Year: 2003
Pages: 150
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net