8000 added alternate solution to multiply using Exponentiation operator · unconnect/javascript-exercises@894ae2d · GitHub
[go: up one dir, main page]

Skip to content

Commit 894ae2d

Browse files
committed
added alternate solution to multiply using Exponentiation operator
1 parent fda6819 commit 894ae2d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

calculator/calculator.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ const power = function(a, b) {
2020
return Math.pow(a, b);
2121
};
2222

23+
//alternate solution using Exponentiation opertator
24+
const power = function(a, b) {
25+
return a ** b;
26+
};
27+
2328
const factorial = function(n) {
2429
if (n === 0) return 1;
2530
let product = 1;

0 commit comments

Comments
 (0)
0