Quantcast

JavaScript gets Block-Level Scope!

JavaScript 1.7 introduces the let statement, which gives JavaScript block-level scope! I’m excited about let, but much more excited about HTML Canvas. Canvas lets you make great graphics web apps with JavaScript that run in any modern browser. I’ve been playing with Canvas and have made some cool apps; I can’t wait to see what others are making!

Hey PHP and Python: stop trying to be like Visual Basic. Get block-level scope already!

Update: Apparently, VB.NET now has block-level scope, but it is *completely* FUBAR:

Even if the scope of a variable is limited to a block, its lifetime is still that of the entire procedure. If you enter the block more than once during the procedure, each block variable retains its previous value. To avoid unexpected results in such a case, it is wise to initialize block variables at the beginning of the block.

No comments yet. Be the first.

Leave a reply