Arrays

Arrays in VBScript and JavaScript are the same in concept but are put together a little differently. The multidimensional arrays in VBScript are easier to work with than their counterpart in JavaScript. Like variables, arrays begin with a Dim statement, but an array size is provided as well. The following shows a simple example:

<% 
Dim item(3) 
item(0) = "Greater Swiss Mountain Dogs" 
item(1) = "Bernese Mountain Dogs" 
item(2) = "Pyrenean Mountain Dogs" 
Response.write item(2) 
%> 

Note that, in VBScript, the array elements are in parentheses and not brackets, but, as in JavaScript, the first element is 0 and not 1.

Multidimensional Arrays

If you are working with more than a single dimension and need to put it in an array in VBScript, you ...

Get JavaScript Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.