In one project I found the following code :
this.moveNode(node = this.getChildOf(node));
Could anyone explain what will be passed to moveNode
after node = this.getChildOf(node)
is executed?
In one project I found the following code :
this.moveNode(node = this.getChildOf(node));
Could anyone explain what will be passed to moveNode
after node = this.getChildOf(node)
is executed?
Your code is equivalent to
node = this.getChildOf(node);
this.moveNode(node);
You should refactor it in two separate instructions as I did above, because it makes the code more readable and obvious. It's also easier to debug, because you can more easily choose to put the breakpoint wherever you want.
This will pass as expected the return of this.getChildOf(node)
.
The execution will follow this order:
this.getChildOf(node)
is called.node
is made. this.moveNode()
is called.