Why is this code incorrect? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is this code incorrect?

The script is supposed to ask for the values of x and n and then put out the x raised to the power of n. Apparently it doesn't work like that 'use strict'; function pow(x,n){ let result = x ** n return result } let x = prompt("x?","") let n = prompt("y?","") alert pow(x,n)

24th Dec 2019, 9:28 PM
Nikita Gusev
Nikita Gusev - avatar
3 Answers
+ 4
alert is normaly a function maybe change it to alert(pow(x, n));
24th Dec 2019, 9:38 PM
Nico Ruder
Nico Ruder - avatar
0
Thank you!
24th Dec 2019, 9:45 PM
Nikita Gusev
Nikita Gusev - avatar
0
No problem
25th Dec 2019, 8:44 AM
Nico Ruder
Nico Ruder - avatar