+ 2

Why the text is not showing in the canvas

What was wrong in JavaScript code .See it in my code link and tell me what was wrong in the code https://code.sololearn.com/WfF1lHo3Sc52/?ref=app

26th Mar 2020, 4:51 PM
Dipanshu Sahu
3 odpowiedzi
+ 5
'font' is a property, not a method, and there's a comma missing between string and numeric arguments inside the fillText() call: var pati=document.getElementById("pokhi"); var paduri=pati.getContext("2d"); paduri.font = "20px"; paduri.fillText("My Canvas",10,20);
26th Mar 2020, 5:01 PM
visph
visph - avatar
+ 2
You have error on line 9 & 10: Line 9: you forgot = after font paduri.font=("20px") Line 10:you forgot , after "My canvas" text; paduri.fillText("My Canvas" ,10,20);
26th Mar 2020, 5:00 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
Sudarshan Rai 👑 visph thanks for your answer. I understand what was wrong
27th Mar 2020, 3:34 AM
Dipanshu Sahu