Created
September 20, 2018 16:17
-
-
Save Drag13/a11b5d77eb4babf91a9960386ec99d53 to your computer and use it in GitHub Desktop.
This file contains 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
function MyArray(arr) { | |
const _arr = arr || []; | |
this.push = function push(value) { | |
console.log('prepush'); | |
_arr.push(value) | |
console.log('postpush'); | |
} | |
this.get = function getByIndex(index) { | |
return _arr[index]; | |
} | |
} | |
var arr = new MyArray(); | |
arr.push('5'); | |
console.log(arr.get(0)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment