Created
November 26, 2019 20:58
-
-
Save metanomial/c8353f56b04fb00f3b29e39816944b8a 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 polynomial(...coefficients) { | |
return function(x) { | |
let result = 0; | |
for(const [index, coefficient] of coefficients.entries()) result += coefficient * x ** index; | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment