+ 2

What is the mistake in this code

I made a code using JavaScript to get the square root of the number given by user using prompt. But it was showing an error. https://code.sololearn.com/WH7yyc0ATB6J/?ref=app

9th Feb 2018, 11:31 AM
Mohd. Ahtesham
Mohd. Ahtesham - avatar
1 Réponse
+ 2
<button onclick=" var a = prompt('Enter the number'); var b = Math.sqrt(a); document.write(b);">Squre Root</button> change this you wrote "" (confusions with begining and ending "") and had = between write and (b) https://code.sololearn.com/WFyovatNcEKY/?ref=app also better use js tab
9th Feb 2018, 11:34 AM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar