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.

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.


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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

13 Experts available now in Live!

Get 1:1 Help Now