Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Array Object Methods

Method Description
concat() Joins two or more arrays, and returns a copy of the joined arrays array1.concat(array2,array3,...,arrayX)
indexOf() Search the array for an element and returns it's position array.indexOf(item,start)
join() Joins all elements of an array into a string array.join(separator)
lastIndexOf() Search the array for an element, starting at the end, and returns it's position array.lastIndexOf(item,start)
pop() Removes the last element of an array, and returns that element array.pop()
push() Adds new elements to the end of an array, and returns the new length array.push(item1, item2, ..., itemX)
reverse() Reverses the order of the elements in an array array.reverse()
shift() Removes the first element of an array, and returns that element array.shift()
slice() Selects a part of an array, and returns the new array array.slice(start, end)
sort() Sorts the elements of an array array.sort(sortfunction)
splice() Adds/Removes elements from an array array.splice(index,howmany,item1,.....,itemX)
toString() Converts an array to a string, and returns the result array.toString()
unshift() Adds new elements to the beginning of an array, and returns the new length array.unshift(item1,item2, ..., itemX)
valueOf() Returns the primitive value of an array array.valueOf()

 

Date andTime

There are four different Date Constructorsthat you can use to create an instance of the DateObject and they are listed below. If you supply no Arguments, then the default

version is used with the current date and time in GMT format. The second Date Constructortakes a Stringas the Argument in the format listed in the syntax or recognizedby the Static parse()Method. The third and fourth Date Constructorstake integersasArguments. The hours, minutes, and secondsArguments are optional, and zero, if omitted.

Date Constructors Syntax:

new Date() //default version

new Date("month day, year [hours:minutes:seconds]") //String Values

new Date(year, month, day) //Integer Values

new Date(year, month, day[, hours, minutes, seconds]) //Integer Values

The initializeTime()Function constructs a new instance of the DateObject with the newOperator and the Date()Constructor and converts it from the number of milliseconds that have elapsed since January 1, 1970, to a usable format in general use for any particular geographical region by using the toLocaleString()Method. It is then assigned to the valueProperty of the Textfield named TextTimeby calling the output()

Function. Then the process is repeated so that the time is updated every second by using thesetTimeout()Method, which calls the initializeTime()Function every 1000 milliseconds, which is, of course, every second.

Finally the BeenHereXT()Function constructs a new instance of the DateObject namedlater, which is always the current time because the setTimeout()Method causes a newDateObject to be constructed each time it calls the BeenHereXT()Function, which is once per second.



.

 


Date: 2016-01-03; view: 880


<== previous page | next page ==>
Number Object Properties | Properties and arguments.callee arguments.callee.caller
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.009 sec.)