CoverYourASP --> Snippets

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
29 active users
1162 visitors today
1118 pages today
(only part of today)
Tools I use

Copyright © 1999-2016 James Shaw.
All rights reserved.

RSS submissions

Now open source with SourceForge!

"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?


Why do you use JavaScript? Why not VBScript?

Is there a limitation with VBScript?


Well, Im 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

Featured sponsor
My favorite resources

CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?

Qualify for Free Trade Magazines

Free subscriptions to industry leading publications for those who qualify!