HTML5 Canvas Tutorial: 2D rendering context #1

  • 🎬 Video
  • ℹ️ Description
preview_player
UCOmFcwNbdxxRXR6Xza0m4Ew



Other links of interest:

💬 Comments
Author

Are you using windows.onload (as in plural windowS) or window.onload (as in only one window)?

Author — Rodrigo Silveira

Author

I tried to do the same code, but with an external js file that runs the function within a winows.onload function, and I noticed that when I tested the variables in the console window it returns "undefined".

Author — redleome

Author

Also, if your variables are inside a function, you won't be able to access them fro your browser's console because of scoping. Variables inside a function (with var keyword) are only visible withing that function, and not from the global scope, which is what the console has access to.

Author — Rodrigo Silveira