Friday, 21 September 2012

Comparison of JavaScript and VBScript


  • JavaScript is the default scripting language for browsers but VBScript must be specified as the scripting language.
        <script type="text/vbscript"
  • JavaScript has cross-platform support from all popular browsers while VBScript is supported MS IE only.
  • JavaScript is case sensitive but VBScript is not this would not be prone to as many syntax errors.
  • In Javacsript there is no way to force variables to be declared, but in VBscript if "Option explicit" statement is declared then it is mandatory to declare all vars before being used.
  • In VBscript can’t assign values to variable on same line, but in Javascript you can.
       Javascript: var z = 10
        VBscript:
        Dim z
        z = 10  
  •  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. Javascript example-
           [Concatenation]
             var x
             x = "God"
             x = x + " is great!"
          [Addition]
            int x=1
            int y=2
            int z
            z=x+y

No comments:

Post a Comment