Last active
August 6, 2022 15:10
-
-
Save edwinwong90/9a6a1601ef331c98b7ef54d3aff7733e to your computer and use it in GitHub Desktop.
Effortless print each array method result for debugging
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
if (!Array.prototype.print) { | |
// eslint-disable-next-line no-extend-native | |
Array.prototype.print = function () { | |
if (this == null) { | |
throw new TypeError("this is null or not defined") | |
} | |
console.log(this) | |
return this | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment