difference between Javascript and VBScript in client

Posted on 2002-04-22
Last Modified: 2012-06-21
Hi!Every One!
  Wneh I write client script ,I may adopt javascript(*.js) and Vbscript(*.vbs),I want to know the differenc between javascript and vbscript in client!
  please explain it for me!thanks!
Question by:oceanyang
LVL 30

Accepted Solution

third earned 100 total points
ID: 6961945

VBScript vs JavaScript

VBScript allows explicit destruction of objects, whereas JavaScript is a "garbage collected" language.

VBScript allows you to define public/private members in classes, whereas in JavaScript, all members are (basically) public.

VBScript supports the "SafeArray" data type, whereas JavaScript doesn't. MS JScript adds the Enumerator() object to compensate for this.

VBScript supports passing "by reference" whereas JavaScript only allows passing "by value."

JavaScript has a more concise syntax, whereas VBScript is often extremely verbose.

JavaScript allows you to supply a dynamic number of arguments to a function, whereas VBScript forces you to send the exact number of arguments specified in the function (or sub) declaration.

JavaScript is supported in many web browsers, whereas VBScript is only supported in Internet Explorer.

JavaScript allows you to add members to existing objects (such as String, Number, etc) whereas VBScript does not treat strings, numbers, etc. as objects, and thus does not allow new methods to be defined.

LVL 30

Expert Comment

ID: 6961950
recommendation: use javascript


Expert Comment

ID: 6961957
Also in the client, Netscape doesn't support vbscript (without some kind of plugin anyway).  Follow Third's recommendation and use JavaScript in client-side code.

Serverside asp code is often done in vbscript, which is fine since the server has no compatibility issues with the client browser to worry about.

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

LVL 20

Expert Comment

ID: 6961970
this is the most important comment:
>JavaScript is supported in many web browsers, whereas VBScript is only supported in Internet Explorer.

thus crossbrowser compatibility..
besides you will learn the java language syntax this way and can later easily move to java by assimilating OOP

Expert Comment

ID: 6962029
third what do u mean by this ?

VBScript allows explicit destruction of objects, whereas JavaScript is a "garbage collected" language.


Expert Comment

ID: 6962333
#### VBScript

Set newObj = CreateObject("X.Y")

Set newObj = Nothing

#### JavaScript

var newObj = new ActiveXObject("X.Y");

var newObj = null;

I guess this is what third means?
LVL 44

Expert Comment

ID: 6962624
AlfaNoMore...not quite.   What happens in a 'garbage collected' language, is that every so often (user/developer has no control over how often), the language engine goes thorugh all of the open object references and determines which ones are no longer being actively used (known as 'garbage'), and those that are not active are then destroyed, releasing the memory back to the heap.  VBScript uses "reference counting", so that when an instance of a class is created, an internal counter(calle the RefCount) is incremented by one, and when a reference is destroyed, the RefCount is decreased by one.  When the RefCount of references to an object reaches 0, then the object is destroyed, and the memory is released.

Arthur Wood
LVL 30

Expert Comment

ID: 6964369
well said Arthur. there's nothing more i can say. thanks for explaining it for me. ;-)
LVL 58

Expert Comment

ID: 8823974
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Answer by third
Please leave any comments here within the next seven days.
EE Cleanup Volunteer

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Table header not displaying on Firefox and Chrome 7 158
An ASP query I cannot work out... 2 46
how to hide hopscotch tour popup page reload? 2 76
Import csv files to MS SQL 5 81
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Sending a Secure fax is easy with eFax Corporate ( First, just open a new email message. In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
In a recent question ( here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now