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
27 active users
1289 visitors today
1468 pages today
(only part of today)
Tools I use

CoverYourASP
Copyright © 1999-2014 James Shaw.
All rights reserved.

ASP.NET Blog
RSS submissions
E-commerce

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?

Roy:

Why do you use JavaScript? Why not VBScript?

Is there a limitation with VBScript?

Me:

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


Qualify for Free Trade Magazines

Free subscriptions to industry leading publications for those who qualify!


New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!