Skip to content

Instantly share code, notes, and snippets.

@JagoWang
Created May 9, 2013 06:10
Show Gist options
  • Save JagoWang/5545861 to your computer and use it in GitHub Desktop.
Save JagoWang/5545861 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
Array.prototype.ayromove = function(dx) {
if(isNaN(dx)||dx>this.length){return false;}
this.splice(dx,1);
}
var arr = ['a', 'b', 'c'];
console.log("elements: "+ arr + " nLength: " + arr.length);
arr.ayromove(1); //删除下标为1的元素
console.log("elements: "+ arr + " nLength: " + arr.length);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment