Why I am unable to get the context of canvas in this code? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 5

Why I am unable to get the context of canvas in this code?

I want to get the context but I am unable . Please help!! https://code.sololearn.com/W4BDnjv2nhob/?ref=app

4th Jun 2019, 5:34 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
5 Respostas
+ 1
You should add onload event to load HTML first. Look at the code. https://code.sololearn.com/W4gzTC91cUjL/?ref=app
4th Jun 2019, 5:56 PM
TheWhĀ”teCat šŸ‡§šŸ‡¬
TheWhĀ”teCat šŸ‡§šŸ‡¬ - avatar
+ 6
TheWhĀ”teCat okay that means we need to use window onload function when we arw writing it in the js tab. Thanks for clearing all of my queriesšŸ˜ŠšŸ˜ŠšŸ‘.
4th Jun 2019, 6:51 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 5
TheWhĀ”teCat is it necessary to define an onload function. I mean why the onload function is not defined here? https://www.sololearn.com/learn/HTML/2201/
4th Jun 2019, 6:13 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 1
If you do it in the HTML "script" tag it is loaded together with HTML. See the other example https://code.sololearn.com/WjQpw4BqyU6f/?ref=app
4th Jun 2019, 6:21 PM
TheWhĀ”teCat šŸ‡§šŸ‡¬
TheWhĀ”teCat šŸ‡§šŸ‡¬ - avatar
+ 1
Prince PS , you are welcome. I'm happy to help šŸ˜‰
4th Jun 2019, 6:52 PM
TheWhĀ”teCat šŸ‡§šŸ‡¬
TheWhĀ”teCat šŸ‡§šŸ‡¬ - avatar