0

How to do the code for the circle? Any errors?

Hii so this code is supposed to draw a circle if the user inputs 1, rectangle if 2, line if 3, and the user is supposed to input the radius, coordinates etc and it will show that stuff on the canvasā€¦ im particularly confused about the case 1 bit (circle stuff) in the js section and i dont know what syntax error there isā€¦ plz help im so confused https://code.sololearn.com/Wjvle92vAQ08/?ref=app

17th Jan 2022, 5:06 AM
JaŠ˜ŠøŠµŠ£ o_O
JaŠ˜ŠøŠµŠ£ o_O - avatar
2 Answers
+ 3
I noticed you use the value from prompt() directly, without converting it to numeric value. Maybe you could start there. About error on line 26, it happens because line 27 is supposed to be joined with line 26 (at the end). If you use SoloLearn app, you will have to wrap your JS code inside "load" event handler. Otherwise you'll get another error (DOM not completely structured). window.onload = function() { // your code here } P.S. Please use tags appropriately. No one is dumb, don't call yourself dumb, it's no good for your mental health. https://code.sololearn.com/W3uiji9X28C1/?ref=app
17th Jan 2022, 6:17 AM
Ipang
+ 1
Ipang ok, thanks for the advice šŸ˜Š
17th Jan 2022, 9:20 AM
JaŠ˜ŠøŠµŠ£ o_O
JaŠ˜ŠøŠµŠ£ o_O - avatar