Is there an arraylist in Javascript?

Viewed 332938

I have a bunch of things I want to add into an array, and I don't know what the size of the array will be beforehand. Can I do something similar to the c# arraylist in javascript, and do myArray.Add(object); repeatedly on it?

10 Answers

Try this, maybe can help, it do what you want:

ListArray

var listArray = new ListArray();
let element = {name: 'Edy', age: 27, country: "Brazil"};
let element2 = {name: 'Marcus', age: 27, country: "Brazil"};
listArray.push(element);
listArray.push(element2);

console.log(listArray.array)
<script src="https://marcusvi200.github.io/list-array/script/ListArray.js"></script>

Related