Can soneone tell me the error in this in the context one? | Sololearn: Learn to code for FREE!

0

Can soneone tell me the error in this in the context one?

var canvas = document.createElement("canvas") document.body.appendChild(canvas) /*canvas.width = 300px canvas.height = 300px*/ var context = canvas.getContext('2d') context.fillStyle = 'green' context.fillRect(0, 0, 10, 10) var x = 0 window.requestAnimationFrame(function loop() { x += 1 context.fillStyle = 'red' context.fillRect(0, 0, 100, 100) }) /*var c =document.getElementById("mycanvas"); var ctx = c.getContext("2d"); ctx.fillText("Start", 0 , 10);*/ /* context.font ='25px Arial'; context.fillStyle ='black'; context.fillText("Start Game",100,200);*/

8/8/2022 5:01:14 PM

s-tech JOKER

3 Answers

New Answer

+3

You can link your code like this: Click +, Insert Code, sort for My Code Bits, select your code. This way it is more readable and people can test your code.

+2

What error are you talking about?

+1

https://code.sololearn.com/WT8WwZKjZiL4/?ref=app