Arrays in javascript

I don’t have found a solution - perhapts it is too easy?
I will use a Array in a script.
But I can’t import anything and the examples I found are not functional.

I think I need the imports or anything.

I use OH3 on a Raspberry4B

I test with “import” - error: import is not defined.
A Array -definition like Java is an error too…

Thank You for a little help

Can you please elaborate a bit more what you want to do?

Which examples do you speak of?

import statements as in Java or in JavaScript ESM aren’t supported, you need to use CommonJS require to import stuff, but for your use case you do not need to import anything.

In JavaScript, Arrays can be defined using the Array literal syntax: var myArray = [‘element1’, 5, true].

Given that you don’t know how to create an Array in JS, I’d recommend to use Blockly and have a look what JS code it generates and you should definitely have a look at a Getting Started with JavaScript tutorial, there are many on the web.