CoverYourASP --> Snippets |
| "Snippets" are mini-articles - they allow me to very quickly add answers to your frequently asked questions, and add brief explanations for topics that you've searched for without success. So, everytime you send an email or perform a search, chances are a new snippet will be the result!6 Oct: Why use JavaScript instead of VBScript?Roy:Why do you use JavaScript? Why not VBScript? Is there a limitation with VBScript? Me: Well, I�m a C/C++ programmer so JScript was the natural choice. The syntax is almost identical to C++. Plus I have this prejudice against anything BASIC � must be my upbringing. ;-) Functionally, you can choose either. Below is a useful list that Marshall Burns sent me, or you can read my thoughts on Porting JScript to VBScript. Advantages of JavaScript: Code elements, such as names of variables and functions, are case sensitive. Provides for multi-line comments (with /* */), which VBscript does not. Operators (eg, ==, !=) and string constants (eg, '\n', '\r') look like in C. Provides shortcut assignments (e.g., a += 1), which VBscript does not. Has classes, which VBscript does not. Note: the latest 5.0 VBScript engine does Kukreja's comparison table (see below) says JavaScript has better flexibility & flow, modularity, and extensibility. The Kukreja reference says VBscript has a 1024-character limit on strings. But this must refer to an old version because the MS doc says the limit is about 2 billion characters. Advantages of VBscript: Has "option explicit" statement, which prevents variables from being declared accidentally. JavaScript does not provide this capability. Provides functions for formatting numbers and date/times, which, amazingly, JavaScript does not. Many more users than JavaScript. Code will be easier to have maintained by outside contractors. Further Reading Comparison chart: "PHP, Javascript and VBScript Language Summary" by John Lim Brief discussion of differences: "JavaScript Demos: VBScript vs. JavaScript" by Jim Cerny |
|