Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which is more versitlie? VBscript or Javascript?

Status
Not open for further replies.

Haunter

Programmer
Jan 2, 2001
379
US
In the forums, it seems that ppl like VBscript better than Javascript. Is VBscript more powerful or versitile? What makes one better than the other? Is there an IDE for VBscript or do you just use browser errors? I know very little about VBscript I am wondering if it would be valuable to learn it over Javascript?
 
If you're going to use scripting in web pages, and don't have control over which browser is used, you HAVE to use Javascript, since only IE supports VBScript.]

For Windows Scripting Host scripts, it's a matter of taste and preference. I use VBScript for scripts to run on my computer, but Javascript in web pages. VBScript isn't case sensitive, so you don't have to worry about capitalization (or the lack of it) like in Javascript. Javascript does objects MUCH nicer than VBScript, so if you're familiar with object-oriented programming, that'd be the best choice. It's much easier to simulate database records with several fields with Javascript (using objects) than VBScript, I think.

Both can access WSH objects with equal ease and power. If you're used to Visual Basic, or the old QBasic, then you'll feel fairly at ease with VBScript. If you know C, C++, Java, or one of the other C-based languages, you'll find Javascript more comfortable.

I like some of Javascript's string handling functions better than VBScript, but VBScript has more flexible popup message boxes. Each language has built-in functions that the other doesn't, but those would be easy to develop yourself once you knew the language.

The answers you'll get to this question will probably be more subjective than objective, and based on what the programmer was originally familiar and comfortable with.
 
I do both languages, and have to agree with trollacious in that JavaScript is the language to use if you're developing web-based apps. You have no control over which browser the user has, but if you REALLY want to use VBScript you CAN use browser detection scripts in JavaScript to redirect users accordingly. If they've got Netscape, you can send them to a page warning them that the site needs to be viewed using IE 4.0 or better. If they're using IE, then you SHOULD be fine....but there are probably compatibility issues with VBScript that doen't exist with JavaScript. JS is a more universally "browser-accepted" language than VBscript. If they're running just about ANY 4.x browser, your JS scripts will be fine......

Of course, if you're NOT developing pages for web-based use, and you have control over which browsers the viewer will be using, VBScript would be my main choice. With it, you have the ability to do a TON of file functions (read/write, filecopy, DIR listing, FileExists, DirExists, etc, etc), and DB connectivity. I've currently working on a interdepartmental project using ASP pages that connect to a central DB. Powerful stuff, and I couldn't have done it with JavaScript.

As with ANY language, BOTH have their advantages and disadvantages based on what you're going to be using them for.
 
Ty that sums it up for me pretty well. I program in PERL for just about anything linux based. But just did not want to miss a good thing in VBscript. You know you just cant have to many tricks in your bag.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top