Created
November 12, 2019 17:33
-
-
Save ilopX/b073772502455d1d52c825c40bf94f76 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 listNum(operation) { | |
let oneNumber = parseInt(this.join('')) | |
return operation(oneNumber).toString() | |
.split('') | |
.map(val => new Number(val)) | |
} | |
Array.prototype.increment = function() { | |
return listNum.call(this, (val) => ++val) | |
} | |
Array.prototype.decrement = function() { | |
return listNum.call(this, (val) => --val) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment