0

var n = prompt("Enter radius of circle (cm)", ""); var area = n * n * Math.PI; alert("Area of circle is " + area + " cm");

How do write cm^2 in javascript(on last line), please? I don't know. (I am not good at English)

22nd Jul 2017, 8:26 AM
Đại Ngư
3 Respuestas
+ 2
alternate option var n = prompt("Enter radius of circle (cm)", ""); var area = n * n * Math.PI; var power="\u00B2"; alert("Area of circle is " + area + " cm"+power); you have to use character code to show the specific character .
22nd Jul 2017, 9:50 AM
Sumit
Sumit - avatar
+ 1
I don't understand. I code on smart phone.
22nd Jul 2017, 9:45 AM
Đại Ngư
+ 1
Thank you verry much!
22nd Jul 2017, 9:56 AM
Đại Ngư