Javascript 4
Javascript 4
8-1
JavaScript Math Object and its methods CS114
• The Date object consists of several methods that will allow you to
determine the current time and date and perform calculations
between dates or times.
• You must create a date object with the keyword new before you
can manipulate date object.
• Example
8-2
CS114 JavaScript Math Object and its methods
o stringName.property
o stringName.methodName(parameters)
Method Description
8-3
JavaScript Math Object and its methods CS114
document.write(text.toUpperCase( ) );
8-4
CS114 JavaScript Math Object and its methods
document.write(text.charAt(2)); //
document.write(text.substring(12,19));
// will display Computer
document.write(text.substring(21,26));
// will display School
document.write(text.indexOf("M"));
// will display 5
8-5
JavaScript Math Object and its methods CS114
5.0 Bibliography
8-6