Visual Studio .NET - Tell me the difference between Java Script and VB script in a sentence for interview purpose

Asked By chitanya chitanya on 18-Jan-07 04:17 AM

for interview purpose can any one tell me the difference between Java Script and Vb script

in a sentence



JavaScript & VBScript - mv ark replied to chitanya chitanya on 18-Jan-07 04:36 AM

JavaScript is a scripting language that works in all browsers whereas VBScript is a scripting language that works only in IE.

For detailed info, check -
http://w3schools.com/vbscript/
http://w3schools.com/js/

javascript vs vbscript - sundar k replied to chitanya chitanya on 18-Jan-07 07:23 AM

Comparison of JavaScript and VBScript

Similarities

1. Both languages are easy to learn and do not require any expensive development tools
2. Both can be used to enhance web pages
3. They run on client machines and can substitute CGI programs to reduce server loads
4. Both can abuse and run malicious scripts on clients' machines

Differences

1. JavaScript is the default scripting language for browsers but VBScript must be specified as the scripting language.
2. JavaScript has cross-platform support from all popular browsers while VBScript is supported MS IE only. VBScripters would thus loose a sizable audience.
3. One of the most significant issues with JavaScript is that there were different releases of the language since its inception (version 1.0). Similarly, different versions of browsers exist on users machines. Therefore, code written for one version may not necessarily work on another. More testing would be necessary thus, development time increases.
4. JavaScript is case sensitive but VBScript is not this would not be prone to as many syntax errors.<
5. JavaScript uses the same character for concatenation as it does for addition (the + character) while the '&' concatenating character is used in VBScript. This is another source of errors in JavaScript.

if you want to know some more ,

Javascript -vs- VBScript, pros and cons compared

http://blog.throbs.net/default,date,2005-06-13.aspx

http://uopteamc.tripod.com/javavb.html

Comparing JavaScript and VBScript - K Pravin Kumar Reddy replied to chitanya chitanya on 18-Jan-07 09:39 AM

Comparing JavaScript and VBScript

Although the World Wide Web is very powerful for displaying information, traditional Web pages are static and cannot interact with users in the way that most computer programs do. The birth of client-side, browser-based scripting engines such as JavaScript and Visual Basic Scripting Edition (VBScript) has allowed for the creation of actual client applications that are automatically downloaded with the content of a Web page when it is accessed. The scripts can then execute on the client machine as traditional programs do or in reaction to user manipulation.

Two competing scripting standards, Visual Basic Script and JavaScript, have been introduced to provide client-side execution. The parent company of each engine has designed its scripts to be optimal for a particular set of tasks. JavaScript, created by Netscape Communications Corp., seeks to be the standard for the Internet and the primary automation language used to control and activate Java applications. Microsoft has created VBScript to focus on the corporate Intranet, as a tool in providing client/server solutions. VBScript is specifically targeted at applications based on Web technology, and classic Visual Basic is geared toward traditional client/server solutions.

In this article, I examine both implementations (VBScript included with Internet Explorer 3.0 and JavaScript included with Netscape Navigator 3.0), their strengths and weaknesses, how they are used in development, and some of their target applications. Choosing a scripting engine depends on your intended task because both engines excel in the areas they are targeting.

reference

http://www.dbmsmag.com/9610i07.html

Differences - mohd khan replied to chitanya chitanya on 02-Apr-07 01:49 AM

java script is supported across browsers.vb script is supported for IE only.

java script is case sensitive.vbscript is not case sensitive.

java script is founded by sun microsystems while vb script is founded microsoft

diff b/w css and dhtml - gomathi pappu replied to chitanya chitanya on 01-Oct-08 07:18 AM

i want the difference between css and Dhtml.. anybody help me for my viva voice

diff js vs vbs - gomathi pappu replied to chitanya chitanya on 01-Oct-08 07:29 AM

especially VBScript and Java script and difference in their syntax...

Feature

JScript and Javascript

VBScript

Example (print 1 to 10 on a web page)

<html> <body>
<%
for (i=1; i<=10; i++)
 Response.Write(""+i+"<br>")
%> 
</body></html> 
<html> <body>
<%
for i = 1 to 10
 Response.Write(i & "<br>")
next
%> 
</body></html> 

Script Tags

<%      %>

<%=  return expression %>

<%       %>

<%=return expression %>

End of statement

End of line or optional semicolon

End of line

Comments

http://phplens.com/phpeverywhere/node/view///?PHPSESSID=e1ed2daf66b769ae8dd5e164e468ba84 JScript comment
/* This is a 
   multi-line
   Jscript Comment */
' VBScript comment

Variables

No prefix

No prefix

Need to declare variables?

Optional. Error if variable not initialised when used.

var AVAR

Optional. Error if variable not initialised when used.

Dim AVAR

Loosely Typed Variables

Yes

Yes

Case-Sensitivity

Yes for variables and reserved words

No

Strings

Delimited by single-quotes or double-quotes.

Delimited by double-quotes.

String Concatenation

The + (plus) symbol.

s = 'A' + 'B'

The & (ampersand) symbol.

s = "A" & "B"

String Evaluation

No

No

Common string constants

Line feed: "\n"
Carriage return: '\r'

Line feed: vbLf
Carriage return: vbCr

HTML encoding functions

escape(str) All spaces, punctuation, accented characters, and any other non-ASCII characters are replaced with %xx encoding

unescape(str) inverse of escape

Requires ASP Server object (and consequent COM overhead).

Server.HMTLEncode( ) Similar to PHP's htmlspecialchars.

Server.URLEncode( ) Similar to PHP's urlencode.

 

Regular Expressions

Built-in.

if (str.match(/php/i))
  Response.Write("php found")

Use COM object RegExp. Only available with the latest versions of VBScript (5.5 or later).

Dates

adate = new Date();
adate = new Date(2000,1,30)

Response.Write(''+adate)

Dates are formated using the current locale configured in the control panel, so you have to hand-code date formatting or change your locale.

adate = Now
date= CDate('2000-1-30')
       
FormatDateTime(adate,2) 

Dates are formated using the current locale configured in the control panel, so you have to hand-code date formatting or change your locale.

Arrays

Declare with
avar = new Array(1,'two');

For indexing use [ ]. Arrays begin with zero element.

Use array.length to get size of array.

Declare with
DIM avar(2)

For indexing use ( ). Arrays begin with zero element.

 

Associative Arrays

Yes

avar = new Array();
avar['newton'] = 'isaac';
Response.Write(avar['newton']) 

Not built into the language, but can simulated using the Dictionary object (which is not thread-safe in VBScript 5.0).

True and False

Has constants true and false.

Empty strings and zero will evaluate to false.

Has constants true and false.

Unlike PHP and JScript, zero does not evaluate to false.

Equality

== true if equal
!= not equal

 

 

=== true if equal & same type

!== not identical

JScript does not have the 0/false problem.

= true if equal
<> not equal
 

Assignment statements

Allows C style shortcut assignments. For example, to append a string to a variable:

avar += 'append to end';

No shortcut assignments.

Sending HTML to Browser

Response.Write(avar);

Response.Write(avar);

If statements

Similar to PHP and C.

if len(avar) = 0 then
  avar = "abc"
else
  avar = avar & "end"
endif

While statements

while (a > 0) a -= 1;
while a > 0
  a = a - 1
wend

For loops

for (i=0,m=9; i<m; i++) {
 Response.Write(i);
} 
for i=1 to 100
  Response.Write(i)
next 

Switch/Case

switch(aColor) { 
case 'red': 
 do1
 break
case 'green': 
 do2
 break
default: do3; break;
} 
select case aColor
case "red"
   do1
case "green"
   do2
case else
   do3
end select

Re :: Difference Between Javascript & VBScript - Shailendrasinh Parmar replied to chitanya chitanya on 25-Feb-09 03:54 PM


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.

Hope this helps.