How to do Array Push?

Hello everyone,
I’m trying to push a value in an array. Example if a value does not exist in the array then do the push.

{
  "Command": "storeEval",
  "Target": "new Array(\"AAA\");",
  "Value": "arrayId"
},
{
  "Command": "storeEval",
  "Target": "storedVars['arrayId'].indexOf('BBB')",
  "Value": "indexFound"
},
{
  "Command": "if",
  "Target": "${indexFound} > -1",
  "Value": ""
},
{
  "Command": "storeEval",
  "Target": "storedVars['arrayId'].push('BBB')",
  "Value": ""
},
{
  "Command": "endif",
  "Target": "",
  "Value": ""
}

or something like that:

{
“Command”: “storeEval”,
“Target”: “new Array(“AAA”);”,
“Value”: “arrayId”
},
{
“Command”: “storeEval”,
“Target”: “storedVars[‘arrayId’].indexOf(‘BBB’)”,
“Value”: “indexFound”
},
{
“Command”: “if”,
“Target”: “${indexFound} > -1”,
“Value”: “”
},
{
“Command”: “storeEval”,
“Target”: “storedVars[‘arrayId’] [10] = ‘BBB’”,
“Value”: “”
},
{
“Command”: “endif”,
“Target”: “”,
“Value”: “”
}

What exactly goes wrong? The DemoStoreEval macro contains a test case on how to use arrays and storedVars, here is the relevant part of this macro (starts at source line 154) :

{
  "Command": "storeEval",
  "Target": "new Array ('cat','dog','fish','dog','🐟','frog','dog','horse','??elephant')",
  "Value": "names"
},
{
  "Command": "storeEval",
  "Target": "storedVars['names'].length",
  "Value": "length"
},
{
  "Command": "echo",
  "Target": "array length = ${length}",
  "Value": ""
},
{
  "Command": "storeEval",
  "Target": "Math.floor(Math.random()*storedVars['length'])",
  "Value": "num"
},
{
  "Command": "echo",
  "Target": "num=${num}",
  "Value": ""
},
{
  "Command": "echo",
  "Target": "The next command picks the random item",
  "Value": ""
},
{
  "Command": "storeEval",
  "Target": "storedVars['names'][${num}]",
  "Value": "myrandomname"
},
{
  "Command": "store",
  "Target": "Today is ${mydate}, and we draw a ${myrandomname}",
  "Value": "output"
},

For some reason .push does not work. I don’t know why by I found a way round using .contact that allows you to add one or more values to an array:

{
“Command”: “executeScript_Sandbox”,
“Target”: “return []”,
“Value”: “varArray”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${varArray}.concat([‘Salut’,‘ddd’])”,
“Value”: “varArray”
},

-> varArray [“Salut”,“ddd”]


Note: the dollar sign is not supported by this forum, so it it striped out and missing as a part of the variable below

{
“Command”: “executeScript_Sandbox”,
“Target”: “return {Global_varArraySfUserEmail}.concat([{myEmail}])”,
“Value”: “Global_varArraySfUserEmail”
},

Full array support arrived with V5.5.6, see Arrays in UI vision Selenium IDE++ - #5 by admin