I am trying to redo the delphi example to js. Two cycles. The first is “repeat until”. The second is “do while”. If you specify in delphi the conditions where the comparison takes place by digit, then if it matches, the cycle will be triggered once, if not, then repeatedly. In js, I try to do the same, it happens the other way around, if there is a match, then multiple repetitions, if there is no match, then once. Why is this happening and how to fix it? Delphi:
procedure TForm1.FormCreate(Sender: TObject);
var i:integer;
begin
repeat
i := 1;
ShowMessage(IntToStr(i));
until (i = 0) or (i = 4);
end;
js:
var i;
do
{
i = 1;
alert(i);
}while(i == 0 || i == 4)
1messages! The JS loop will give you exactly one such message.