[Pas2js] for .. in loop

Ryan Joseph ryan at thealchemistguild.com
Fri May 18 16:18:03 CEST 2018



> On May 18, 2018, at 9:11 PM, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
> 
> var
>  o: TJSObject;
>  key: string;
> begin
>  for key in o do writeln(o[key]);
> end;

I don’t understand this.

1) why are we talking about TJSObject? That’s an additional use for..in which is good to know but it’s not an array.

2) Why doesn’t this work with JSArray like you would expect? I mean if a function returns a JSArray of integers for example can’t I use for..in and have the iterator be of type integer? That’s really the question I’m asking.

Regards,
	Ryan Joseph



More information about the Pas2js mailing list