The second post in this video series gives a simple example to understand how to set canvas size. Basically there are two ways to set the canvas size, using canvas elements properties and by using the CSS. Watch the video to understand more.
In this blog post we will dig deeper into various aspects of JavaScript scope. This is a pretty interesting topic and also a topic which confuses many beginning JavaScript programmers. Understanding JavaScript scope helps you write bug free programs (hmm.. atleast helps your troubleshoot things easily) Scope control the visibility and lifetimes of variables and parameters. This is important from the perspective of avoiding naming collisions and provides memory management service. Unlike other languages, JavaScript does not have block level scope. For e.g. take for instance the following piece of c# code. public void Main () { int a = 5; if (true) { int b = 10; } // This will throw compile time error as b is not defined // and not within the scope of function Main(); Console.WriteLine(b); } If you write the same code in JavaScript, then the value of 'b' will be available outside the 'if' block. The reason for this is JavaScript does no...
Comments