setlength problem in webcore

I've populated a TWeb ClientDataSet (cdsPI) with JSON data from an endpoint. Now I want to store the data in a dynamic two-dimensional array (arrDynPI). I'll define this array as either an array or an array or a string. Next I create the code snippet below:

"cdsPI.First;
row := 0;
col := 1;
// fill arrPI
repeat SetLength(arrDynPI,row+1,col);
arrDynPI[row][0] := cdsPItems.FieldByName('name').AsString;
arrDynPI[row][1] := cdsPItems.FieldByName('username').AsString;
cdsPItems.Next;
Inc(row);
until(cdsPItems.Eof);"

However, the SetLength(arrDynPI,row+1,col) command seems to do nothing. In the debugger, arrDynPI remains set to zero (undefined). How to solve this?

I could not reproduce an issue with the following test code:

procedure TForm1.WebButton1Click(Sender: TObject);
var
arrDynPI: array of array of string;
begin
SetLength(arrDynPI, 10, 10);

arrDynPI[0,0] := 'Amazon';
arrDynPI[0,1] := 'OpenAI';

console.log(arrDynPI);

end;