Created
November 25, 2010 19:10
-
-
Save yoshimax/715798 to your computer and use it in GitHub Desktop.
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
| <!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