background preloader

Programming

Facebook Twitter

JScience. Development for Beginners | Training, Videos, Tools, Resources, Learning | MSDN. RubyInstaller for Windows. Www.greatmindsworking.com. JavaScript Garden. Although JavaScript deals fine with the syntax of two matching curly braces for blocks, it does not support block scope; hence, all that is left in the language is function scope. function test() { // a scope for(var i = 0; i < 10; i++) { // not a scope // count } console.log(i); // 10} There are also no distinct namespaces in JavaScript, which means that everything gets defined in one globally shared namespace.

Each time a variable is referenced, JavaScript will traverse upwards through all the scopes until it finds it. In the case that it reaches the global scope and still has not found the requested name, it will raise a ReferenceError. The Bane of Global Variables // script Afoo = '42'; // script Bvar foo = '42' The above two scripts do not have the same effect.

Again, that is not at all the same effect: not using var can have major implications. // global scopevar foo = 42;function test() { // local scope foo = 21;}test();foo; // 21 Local Variables var foo = 3; bar = 4;}test(10); Hoisting. 45 Fresh Useful JavaScript and jQuery Techniques and Tools - Smashing Magazine. Advertisement Yes, this is another round-up of fresh and useful Javascript techniques, tools and resources. But don’t close the tab yet, as you might find this one very useful. In this selection we present calendars, forms, buttons, navigation, debugging, optimization and compatibility tables as well as handy resources and tools. We also cover various jQuery-plugins that will help you extend the functionality of your website and improve user experience with ready components or coding solutions. The last section also covers a number of useful educational resources such as a compilation of useful JavaScript coding practices, a detailed comparison of JavaScript frameworks and general JavaScript programming conventions.

We are looking forward to your feedback. You may be interested in the following related posts: Calendars and Timelines jDigiClock – Digital Clock (HTC Hero inspired)4 jDigiClock is a jQuery plugin inspired from HTC Hero Clock Widget. JavaScript Debugging and Validation Tools Poll. Online IDE. Unbeatable JavaScript Tools.