Created
May 17, 2019 14:44
-
-
Save grossvogel/4c73a2f66e38c841c3dde2da08a59266 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
class Polynomial { | |
//... | |
get derivative() { | |
const newCoefficients = this.coefficients | |
.map((coefficient, degree) => coefficient * degree) | |
.slice(1); | |
return new Polynomial(newCoefficients); | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment