Delete object from array in Javascript Engine


#1

How can i remove an object from an Array in JUCE Javascript Engine, lets say on a given index. Example:

var objects = [{foo: false}, {foo: true}];

How can i, for example. remove the second object which is on index 1?


#2

You can get the array via var::getArray()

var objects = [{foo: false}, {foo: true}];
auto* array = objects.getArray();  // returns Array<var>*
array->remove (1);

Hope that helps


#3

Thanks Daniel!