18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

is this correct var $arr = [];

tinchie8tinchie8 Members
edited November -1 in Sahi - Open Source
hi,

my array don't seem to work. is this correct?

var $arr_animals = [];

$arr_animals[] = {cat,dog,fish,mouse};



coz i got this:

[Exception] SyntaxError: syntax error

i want to check if those animals mentioned in the array are in the select options i have. i tried it on a turbo c program and it seems to be working fine....
why do i get a syntax error with that?

thanks,
=Tinchie=

Comments

  • Hi Tinchie,

    Try using this:
    var $arr_animals = ;

    or

    var $arr_animals = new Array();
    $arr_animals[0] = "cat";
    $arr_animals[0] = "dog";
    $arr_animals[0] = "fish";
    $arr_animals[0] = "mouse";

    Regards,
    Pankaj.
  • lepierrotlepierrot Members
    edited June 2008
    don't forget to change the number of each cell:

    $arr_animals[0] = "cat";
    $arr_animals[1] = "dog";
    $arr_animals[2] = "fish";
    $arr_animals[3] = "mouse";
  • OOPsss!!
    The typical copy paste problem..;-)
    Thanks lepierrot :)
  • thanks everyone... will try this now...
Sign In or Register to comment.