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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 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