Arrays not lists
One of the first things you will notice when exploring Quartex, is that TStringList, TList and TObjectList simply does not exist. We could have implemented them of-course, but it would just add unwanted overhead. In JavaScript, ordinary arrays are objects. This means that they have the same properties and methods that acts on the content as traditional lists have. So under Quartex, ordinary arrays have all the methods and properties that TList and TStringList have (and you don't need to create an array instance) which is really helpful and makes life a lot easier.
// Create an array of string, notice the use of Add()
var lList: array of string;
For var x := 1 to 100 do
Begin
lList.Add( 'Item #' + x.ToString() );
End;
// Join all the items in the list into a single
// string and dump it in the console
WriteLn( lList.Join("") );
So all arrays, regardless of types (including your own types, both records and classes) have the same methods as the traditional TList or TStringList. For example, to sort an array of string you can call the Sort() method. You can also provide your own sort function, including an anonymous function like this:
// Create an array of strings.
Var lList: array of string;
For Var x := 1 to 100 do
Begin
lList.Add( 'Item #' + x.ToString() );
End;
// Perform a sort, providing our own determination function
lList.Sort( function (Left, Right: string): integer
Begin
If asc(Left[1]) < asc(Right[1]) then
Result := 0
else
Result := -1;
End);
For a full overview of all the methods and properties available for arrays, read the section Array Objects.