Skip to content

Instantly share code, notes, and snippets.

@yoshimax
Created November 25, 2010 19:10
Show Gist options
  • Select an option

  • Save yoshimax/715798 to your computer and use it in GitHub Desktop.

Select an option

Save yoshimax/715798 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test Page</title>
</head>
<body>
<script type="text/javascript">
var array1 = [1, 2];
Object.defineProperty(Array.prototype, "test", {value : 1,
writable : true,
enumerable : true,
configurable : true});
Object.defineProperty(Array.prototype, "insert", {
value : function(v, i) {
this.splice(i, 0, v);
return this;
},
writable : true,
enumerable : false,
configurable : true});
console.log(array1.insert(6, 1));
for (var p in array1) {
console.log(p, ':', array1[p]);
}
</script>
<noscript>
</noscript>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment