Files
JavaScript/Maths/Pow.js
Cristian Baciu 2ebe65baff Add Pow.js (#498)
* Add pow.js

* Add tests for Pow.js
2020-12-20 19:08:37 +05:30

12 lines
173 B
JavaScript

// 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 }