Created
February 20, 2014 11:07
-
-
Save sz-alpar/e983afed2227eb4daefb to your computer and use it in GitHub Desktop.
Splice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.deleteFromIndex = function(index) { | |
return this.splice(index,array.length-index); | |
} | |
var array = ["Apple","Turtle","Microsoft","Atari","John","Carter","HTC"]; | |
var array2 = array.deleteFromIndex(2); | |
console.log(array); | |
console.log(array2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment