JS arrays in squiffy

According to what I'm reading, variables (and arrays) in JS are all global in nature. However, I'm not having a lot of luck seeing arrays in functions. An example:

[[Start]]:

    var Arr1 = [];
    Arr1[0]=50;

    set("test1",Arr1[0]); //works
test1={test1}

[[Next]]

[[Next]]:
    set("test2",Arr1[0]); //fails
test2={test2}

Any ideas on how to use an array in other places (either JS functions or other squiffy sections)?


Declaring a variable with var is optional, and makes it local to the current function.


Taking Var out of this code causes it to crash in Squiffy.

Actually, last night I poked around some more and found a conversation where someone talked about the same thing - JS variables and arrays do not cross into new sections - they are local to that section.

If you want to jump a variable to another section, you have to carry it across in a squiffy variable, using Set and Get commands. Which means arrays are out.

Which is okay. Last night in bed, I thought about it and figured a way to do it with just squiffy variables. I'm not sure how keen I am with this -an array would have been perfect. But you do what you can do with this application, I guess.


Log in to post a reply.

Support

Forums