Created
November 20, 2017 23:14
-
-
Save toddmantell/edb7aa96aefedc2a149810875c814fdf to your computer and use it in GitHub Desktop.
Add function to Array.prototype
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
| const numbers = [1,2,3,4,5,6,7,8]; | |
| Array.prototype.logValues = function() { | |
| for (i = 0; i < this.length; i++) { | |
| console.log(this[i]); | |
| } | |
| }; | |
| numbers.logValues(); | |
| const newArrayOfStuff = ['Todd', 67, true, 'Yo!', {id: '890435098435oui4587rteuoiert'}]; | |
| newArrayOfStuff.logValues(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment