- 1
Javascript question
I wanted to create a quadratic equation solver but I stopped here.Who can help me to find my mistake: let a=prompt("Give value for a") let b=prompt("Give value for b") let c=prompt("Give value for c") let d=confirm( Math.pow(b,2)-4*a*c) if(d>0) alert((-b+Math.sqrt(d))/2 * a) alert((-b-Math.sqrt(d))/2 * a)
3 Réponses
+ 2
parse the inputs from the prompt as int, otherwise a, b, c and d will all be Strings...
so:
let a = parseInt(prompt("Give value for a");
...
what errors are happening? Is it an logic error or an runtime error? 😅
+ 2
or parseFloat() would actually make more sense ...
+ 1
Thank you for your help😉