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

3/26/2020 4:51:28 PM

Dipanshu Sahu

3 Answers

New Answer


'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);


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);


Sudarshan Rai 👑 visph thanks for your answer. I understand what was wrong