Find more freelance jobs
|
mother = names[0]
The Date object
The Date object is one of JavaScripts built-in objects. It is used to return a date. To do this you must declare a variable: mydate=new Date() You can write a date inside the parentheses, if not, the "mydate" variable contains today's date, see the Date() example below. Now you can access all the methods in the Date object from this variable. Example: mydate.getDay() The most common methods Methods Explanation NN IE ECMA Date() Returns a new Date object 2.0 3.0 1.0 getDate() Returns the date from a Date object. (1-31) 2.0 3.0 1.0 getDay() Returns the weekday. (0-6) 2.0 3.0 1.0 getMonth() Returns the month. (0-11) 2.0 3.0 1.0 getFullYear() Returns the year. (2000) 4.0 4.0 1.0 getHours() Returns the hour as a value between 0 and 23 2.0 3.0 1.0 getMinutes() Returns the minute. (0-59) 2.0 3.0 1.0 getSeconds() Returns the second. (0-59) 2.0 3.0 1.0 The Math object A built-in object that let you perform mathematic functions. This object is a bit different from the other objects in JavaScript. For example, the Math object is not created with the "new" operator, if you do so, an error will occur. This is how you create the object: Math.random() The most common methods Methods Explanation NN IE ECMA max() Returns the number with the highest value of two numbers 2.0 3.0 1.0 min() Returns the number with the lowest value of two numbers 2.0 3.0 1.0 random() Returns a random number 2.0 3.0 1.0 round() Returns a number rounded to the nearest whole number 2.0 3.0 1.0 Browser: <html> <head> |