FANDOM


Programmer's Wiki
This page has been moved to the Programmer's Wiki.
Please do not make any changes or additions to this page.

Any modifications, if still appropriate, should be made on Array slice at the Programmer's Wiki.

function array_slice(arr, offst, lgth) {
	if (lgth === undefined) {
		return arr.slice(offst);		
	}
	else {
		if (lgth > 0) {
			return arr.slice(offst, offst + lgth);
		}
		else if (lgth < 0) {
			return arr.slice(offst, lgth);
		}
	}
}

Example Javascript UsageEdit

arr1 = new Array("a1", "a2", "a3", "a4", "a5");
alert(array_slice(arr1, 2)); /* Returns: a3,a4,a5 */
alert(array_slice(arr1, -2, 1)); /* Returns: a4 */
alert(array_slice(arr1, 0, 3)); /* Returns: a1,a2,a3 */
alert(array_slice(arr1, 2, -1)); /* Returns: a3,a4 */

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.