How to translate javascript to Kantu (indexof)

Hello, i have managed to create an array in kantu to keep my script clean of so much variables, the problem now is i need to know the array index of some items but i cant make it work with kantu, i cant understand how to translate this:

index = myarray.indexof(element) into kantu language i tried

{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number ({myarray}.indexof({element}))”,
“Value”: “index”
},

but it always give me errors

edit: the dollar symbol its not show here but it is, to avoid messages saying, your problem is the lack of the dollar symbol, it doesnt

Will be nice if Admin will confirm or correct me. I accepted kantuser’s challenge. Here is what I worked out:

{
“Name”: “Get Ads”,
“CreationDate”: “2019-12-30”,
“Commands”: [
{
“Command”: “executeScript_Sandbox”,
“Target”: “myarray = [“Banana”, “Orange”, “Apple”, “Mango”];”,
“Value”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return myarray.indexOf(“Apple”);”,
“Value”: “index”
},
{
“Command”: “echo”,
“Target”: “index”,
“Value”: “”
}
]
}

Looks to me that Kantu does not implement arrays and tries to be case insensitive by converting everything to uppercase.

So, the case insensitivity is fine, but Javascript is case sensitive. If Kantu commands could access Javascript variables, then the case sensitivity and insensitivity would be an issue.

I think that Kantu variables are separate from Javascript variables. So you can have Javascript defined variables with the same name as Kantu variables.

Seems to me that arrays are not implemented in Kantu. However, you can still have arrays because Kantu interfaces with Javascript via executeScript_Sandbox and executeScript commands.

So when my first command (executeScript_Sandbox) executes, you won’t find myarray in the Variables tab. But we see that myarray exists in Javascript because my second command executes returning the correct index. We can view index in the variables tab, or see the echo in the Logs Tab (my third command).