Modifying TJSArray object members lazarus / 76-Pas2JS ---------------------------------------------------------------------- rlsdevine · 2023-02-08 00:58 I'm actually using pas2js from TMS WebCore (Delphi) but this question seems to be a pas2js thing. I have a TJSArray (retrieved via JSON from an API call) that holds a number of objects that define users, e.g. in Object Pascal: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   TUser = record    FirstName: string;    Surname: string;    DisplayName: string;  end; My TJSArray is a private field variable of the class: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   private  FUserList: TJSArray; I'm testing different ways of modifying members of the array: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   // -- The following works correctly.  asm    this.FUserList[0].DisplayName = "Bob1";  end;  console.log('DisplayName: ' + TUser(FUserList[0]).DisplayName);   // -- The following line fails to compile: "Variable identifier expected".  //TUser(FUserList[0]).DisplayName := 'Bob2';  //console.log('DisplayName: ' + TUser(FUserList[0]).DisplayName);   // -- The following works correctly.  TJSObject(FUserList[0]).Properties['DisplayName'] := 'Bob3';  console.log('DisplayName: ' + TUser(FUserList[0]).DisplayName); The puzzle is that I can hard cast TUser(FUserList[0]) to get the DisplayName for the console output, but can't get it to compile when setting the value. Obviously not a show-stopper but curious how to get around this. I also tried (FUserList[0] as TUser) but that won't compile either. Thanks, Bob