crea una lista in javascript

To create a list or an array in JavaScript, you can use the following syntax:

index.tsx
var myArray = [item1, item2, item3];
37 chars
2 lines

or

index.tsx
var myArray = new Array(item1, item2, item3);
46 chars
2 lines

where item1, item2, and item3 are the items you want to include in your list.

For example, to create a list of fruits, you can use the following code:

index.tsx
var fruits = ['apple', 'banana', 'orange'];
44 chars
2 lines

You can also create an empty list and add items to it later using the push() method:

index.tsx
var myArray = [];
myArray.push(item1);
myArray.push(item2);
myArray.push(item3);
81 chars
5 lines

gistlibby LogSnag