Let's move ahead in our HTML5 canvas video series and learn to draw basic shapes. In this video we will learn how to draw basic drawing elements like lines, rectangles. In the next video we will learn how to draw circles and arcs.
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