0
Can you please find the mistake.it's my first code in java script
alert("please upvote if you like") var n = prompt("Enter a number", ""); var answer = Maths.sqrt(n); document.write("The square root of " + n + " is " + answer);
2 ответов
+ 7
Object name is Math, not Maths.
There is a nice documentation if you ever need to see syntax
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
0
Rishik Reddy , hello
Also to use your input as a number you will have to convert it as a number, the prompt input return a type string.
Doesn't using answer variable giving you an error or something like NaN?