Pas2js, typed arrays and ANSI strings lazarus / 76-Pas2JS ---------------------------------------------------------------------- Kryvich · 2019-01-22 11:22 Hi, Can Pas2js transpile Delphi/FPC typed arrays to their counterparts in JavaScript? I mean array of Integer -> Int32Arrayarray of Byte -> UInt8Arrayarray of Word -> UInt16Arrayetc.I see declarations of TJSInt32Array, TJSUint8Array, TJSUint16Array in js.pas, but when I try to transpile my test program I can't find these names in the result JS file. If/when these arrays will be supported by the transpiler, we can move further and try to convert AnsiStrings as UInt8Array. ---------------------------------------------------------------------- Kryvich · 2019-01-22 12:23 OK I can use JavaScript typed arrays using bindings from js.pas! 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 program TestTypedArrays;{$IFDEF PAS2JS}uses  JS;{$ENDIF} type{$IFDEF PAS2JS}  TByteArray = TJSUint8Array;  TWordArray = TJSUint16Array;{$ELSE}  TByteArray = array of Byte;  TWordArray = array of Word;{$ENDIF} procedure Test;var  ba: TByteArray;  wa: TWordArray;begin{$IFDEF PAS2JS}  ba := TByteArray.new(10);{$ELSE}  SetLength(ba, 10);{$ENDIF}  ba[0] := $FF;{$IFDEF PAS2JS}  wa := TWordArray.new(20);{$ELSE}  SetLength(wa, 20);{$ENDIF}  wa[1] := $FFEE;  Writeln('ba[0] = ', ba[0], ', wa[1] = ', wa[1]);end; begin  Test;end. But there is too much IFDEFs. Would be nice to have the same syntax as in Delphi/FPC. ---------------------------------------------------------------------- mattias · 2019-02-18 17:20 At the moment all dynamic arrays are TJSArrays. Using the typed arrays is an interesting proposal.