Add Pow.js (#498)

* Add pow.js

* Add tests for Pow.js
This commit is contained in:
Cristian Baciu
2020-12-20 15:38:37 +02:00
committed by GitHub
parent bb1a5fb720
commit 2ebe65baff
2 changed files with 26 additions and 0 deletions

11
Maths/Pow.js Normal file
View File

@ -0,0 +1,11 @@
// Returns the value of x to the power of y
const pow = (x, y) => {
let result = 1
for (let i = 1; i <= y; i++) {
result *= x
}
return result
}
export { pow }