Skip to content

Commit a197375

Browse files
authored
Convert prompt inputs to numbers with unary plus
Added unary plus to prompt inputs for type conversion.
1 parent 52c1e61 commit a197375

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • 1-js/02-first-steps/15-function-basics/4-pow

1-js/02-first-steps/15-function-basics/4-pow/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ function pow(x, n) {
1010
return result;
1111
}
1212

13-
let x = prompt("x?", '');
14-
let n = prompt("n?", '');
13+
let x = +prompt("x?", '');
14+
let n = +prompt("n?", '');
1515

1616
if (n < 1) {
1717
alert(`Power ${n} is not supported, use a positive integer`);

0 commit comments

Comments
 (0)