[Solved] Need help in converting C++ to javascript


It means that their previous programmer loved being “clever”.

The value of an assignment is a reference to the object that was assigned to, and assignment associates to the right.

--(it1 = it2 = it3)

is

--(it1 = (it2 = it3))

and it’s intended to assign the value of it3 to it2 and it1, then decrement it1.
(I have a hunch that this may be undefined, which is a thing that happens frequently when you’re being clever in C++.)

it1 is apparently intended to be “one step behind” it2.

A more reasonable way to write that is

it2 = it3;
it1 = it2 - 1;

(In JavaScript, I suspect that you need to work with array indices rather than iterators to accomplish the same thing.)

1

solved Need help in converting C++ to javascript