setTimeout() require qualification
The two javascript functions above are very useful. The first one executes something after a set delay, and the second executes something at regular intervals. The syntax is very similar. var time = 2000; // 2 seconds window.setTimeout(function() { alert(‘Yay!’); }, time); window.setInterval(function() { alert(‘Woo!’); }, time); Unfortunately, they weren’t working for me earlier. [...]
ECMAScript 4
John Resig has posted a whitepaper outlining the new features in ECMAScript4 (aka the Javascript standard), how it differs from ECMAScript3, and the rationale for any incompatibilities. Many of the features have already made their way into Opera and Firefox, which is at Javascript 1.7 level. ES3 is equivalent to JS1.3, and ES4 is the [...]
Creating Start Menu shortcuts with Javascript
While preparing the installer for the Web 2.0 Starter Toolkit for IBM DB2, I had to set up Start Menu shortcuts. The way to do that is to work through the Windows Scripting Host (WSH). The WSH supports two built-in languages – VBScript and Jscript – and a theoretical number of third-party alternatives. VBScript is [...]
Reflection in Javascript
It’s very easy to do reflection in Javascript. Reflection is when your code looks onto itself to discover its variables and functions. It allows two different Javascript codebases to learn about each other, and it’s useful for exploring third-party APIs. Preamble In Javascript, all objects are hashes/associative arrays/dictionaries. A hash is like an array, except [...]