Pages

Javascript Array unshift() Method

4/7/14
Description: Javascript array unshift() method adds one or more elements to the beginning of an array and returns the new length of the array. Syntax: array.unshift( element1, ..., elementN ); Here is the detail of parameters: element1, ..., elementN : The elements to add to the front of the array. Return Value: Returns the length of the new array. This returns undefined in IE browser. Example: <html> <head> <title>JavaScript...
Read more ...

Javascript Array toString() Method

4/7/14
Description: Javascript array toString() method returns a string representing the source code of the specified array and its elements. Syntax: array.toString(); Here is the detail of parameters: NA Return Value: Returns a string representing the array. Example: <html> <head> <title>JavaScript Array toString Method</title> </head> <body> <script type="text/javascript"> var...
Read more ...

Javascript Array splice() Method

4/7/14
Description: Javascript array splice() method changes the content of an array, adding new elements while removing old elements. Syntax: array.splice(index, howMany, [element1][, ..., elementN]); Here is the detail of parameters: index : Index at which to start changing the array. howMany : An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed. element1,...
Read more ...

Javascript Array sort() Method

4/7/14
Description: Javascript array sort() method sorts the elements of an array. Syntax: array.sort( compareFunction ); Here is the detail of parameters: compareFunction : Specifies a function that defines the sort order. If omitted, the array is sorted lexicographically. Return Value: Returns a sorted array. Example: <html> <head> <title>JavaScript Array sort Method</title> </head> <body> <script...
Read more ...

Javascript Array toSource() Method

4/7/14
Description: Javascript array toSource() method returns a string representing the source code of the array. This method is supported by Mozilla. Syntax: array.toSource(); Here is the detail of parameters: NA Return Value: Returns a string representing the source code of the array. Example: <html> <head> <title>JavaScript Array toSource Method</title> </head> <body> <script...
Read more ...

Javascript Array some() Method

4/7/14
Description: Javascript array some() method tests whether some element in the array passes the test implemented by the provided function. Syntax: array.some(callback[, thisObject]); Here is the detail of parameters: callback : Function to test for each element. thisObject : Object to use as this when executing callback. Return Value: If some element pass the test then it returns true otherwise...
Read more ...

Javascript Array slice() Method

4/7/14
Description: Javascript array slice() method extracts a section of an array and returns a new array. Syntax: array.slice( begin [,end] ); Here is the detail of parameters: begin : Zero-based index at which to begin extraction. As a negative index, start indicates an offset from the end of the sequence. end : Zero-based index at which to end extraction. Return Value: Returns the extracted array...
Read more ...

Javascript Array shift() Method

4/7/14
Description: Javascript array shift() method removes the first element from an array and returns that element. Syntax: array.shift(); Here is the detail of parameters: NA Return Value: Returns the removed single value of the array. Example: <html> <head> <title>JavaScript Array shift Method</title> </head> <body> <script type="text/javascript"> var element =...
Read more ...

Javascript Array reverse() Method

4/7/14
Description: Javascript array reverse() method reverses the element of an array. The first array element becomes the last and the last becomes the first. Syntax: array.reverse(); Here is the detail of parameters: NA Return Value: Returns the reversed single value of the array. Example: <html> <head> <title>JavaScript Array reverse Method</title> </head> <body> <script...
Read more ...

Javascript Array reduce() Method

4/7/14
Description: Javascript array reduce() method applies a function simultaneously against two values of the array (from left-to-right) as to reduce it to a single value. Syntax: array.reduce(callback[, initialValue]); Here is the detail of parameters: callback : Function to execute on each value in the array. initialValue : Object to use as the first argument to the first call of the callback. Return...
Read more ...

Javascript Array push() Method

4/7/14
Description: Javascript array push() method appends the given element(s) in the last of the array and returns the length of the new array. Syntax: array.push(element1, ..., elementN); Here is the detail of parameters: element1, ..., elementN: The elements to add to the end of the array. Return Value: Returns the length of the new array. Example: <html> <head> <title>JavaScript...
Read more ...

Javascript Array pop() Method

4/7/14
Description: Javascript array pop() method removes the last element from an array and returns that element. Syntax: array.pop(); Here is the detail of parameters: NA Return Value: Returns the removed element from the array. Example: <html> <head> <title>JavaScript Array pop Method</title> </head> <body> <script type="text/javascript"> var numbers = [1, 4, 9]; var...
Read more ...

Javascript Array map() Method

4/7/14
Description: Javascript array map() method creates a new array with the results of calling a provided function on every element in this array. Syntax: array.map(callback[, thisObject]); Here is the detail of parameters: callback : Function that produces an element of the new Array from an element of the current one. thisObject : Object to use as this when executing callback. Return Value: Returns...
Read more ...

Javascript Array lastIndexOf() Method

4/7/14
Description: Javascript array lastIndexOf() method returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting atfromIndex. Syntax: array.lastIndexOf(searchElement[, fromIndex]); Here is the detail of parameters: searchElement : Element to locate in the array. fromIndex : The index at which to start searching backwards....
Read more ...

Javascript Array join() Method

4/7/14
Description: Javascript array join() method joins all elements of an array into a string. Syntax: array.join(separator); Here is the detail of parameters: separator : Specifies a string to separate each element of the array. If omitted, the array elements are separated with a comma. Return Value: Returns a string after joining all the array elements. Example: <html> <head> <title>JavaScript...
Read more ...

Javascript Array indexOf() Method

4/7/14
Description: Javascript array indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present. Syntax: array.indexOf(searchElement[, fromIndex]); Here is the detail of parameters: searchElement : Element to locate in the array. fromIndex : The index at which to begin the search. Defaults to 0, i.e. the whole array will be searched. If the...
Read more ...

Javascript Array forEach() Method

4/7/14
Description: Javascript array forEach() method calls a function for each element in the array. Syntax: array.forEach(callback[, thisObject]); Here is the detail of parameters: callback : Function to test each element of the array. thisObject : Object to use as this when executing callback. Return Value: Returns created array. Compatibility: This method is a JavaScript extension to the ECMA-262...
Read more ...

Javascript Array filter() Method

4/7/14
Description: Javascript array filter() method creates a new array with all elements that pass the test implemented by the provided function. Syntax: array.filter(callback[, thisObject]); Here is the detail of parameters: callback : Function to test each element of the array. thisObject : Object to use as this when executing callback. Return Value: Returns created array. Compatibility: This...
Read more ...

Javascript Array every Method

4/7/14
Description: Javascript array every method tests whether all elements in the array pass the test implemented by the provided function. Syntax: array.every(callback[, thisObject]); Here is the detail of parameters: callback : Function to test for each element. thisObject : Object to use as this when executing callback. Return Value: Returns true if every element in this array satisfies the provided...
Read more ...

Javascript Array concat() Method

4/7/14
Description: Javascript array concat() method returns a new array comprised of this array joined with two or more arrays. Syntax: array.concat(value1, value2, ..., valueN); Here is the detail of parameters: valueN : Arrays and/or values to concatenate to the resulting array. Return Value: Returns the length of the array. Example: <html> <head> <title>JavaScript Array concat Method</title> </head> <body> <script...
Read more ...

Javascript String - sup() Method

4/7/14
Description: This method causes a string to be displayed as a superscript, as if it were in a <sup> tag. Syntax: string.sup( ) Here is the detail of parameters: NA Return Value: Returns the string with <sup> tag. Example: <html> <head> <title>JavaScript String sup() Method</title> </head> <body> <script type="text/javascript"> var str = new String("Hello...
Read more ...

Javascript String - sub() Method

4/7/14
Description: This method causes a string to be displayed as a subscript, as if it were in a <sub> tag. Syntax: string.sub( ) Here is the detail of parameters: NA Return Value: Returns the string with <sub> tag. Example: <html> <head> <title>JavaScript String sub() Method</title> </head> <body> <script type="text/javascript"> var str = new String("Hello...
Read more ...

Related Posts