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
94 active users
9148 visitors today
8490 pages today
how is this done?
Tools I use

CoverYourASP
Copyright © 1999-2016 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, 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

Featured sponsor
My favorite resources


I share my content

Supporting ASPRSS

Do you need a quick and easy way to link to my articles? All the information you need is published with ASPRSS...


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!