0
JavaScript .getContext(â2dâ)
I ask why the .getContext(â2dâ) doesnât work in the code editor but it works in the console? Example: var canvas = document.getElementById(âmycanvasâ).getContext(â2dâ); The error: cannot get context of null It works sometimes but at other times it doesnât. Please answer
1 Answer
0
The playground tries to emulate a browser environment, but also note that it provides for other programming languages.
If all assets from a Chrome console were ported over, the Sololearn app would increase in size.
The service may be offered via internet, but everything about developer consoles is properietary and has little documentation. So, undesired and displeasing effects make themselves known.
If in doubt, check your IDs... NameErrors are common.