difference between Javascript and VBScript in client

Posted on 2002-04-22
Medium Priority
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 400 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.

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 20

Expert Comment

by:Michel Sakr
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

850 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