You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The title was hard to find for me, to make it clear and concise, but actually the problem is simple.
Whether this is a good practice or not, here is what I've done:
During one of my developments, I tried to do something I often do which is recursively traversing a tree from the root to the leaves, removing some properties on each node.
Here the tree had a simple from:
the root
each node has only ONE child node, except the leaf of course
Simple right?
Now the problem comes from the fact that the property I wanted to remove on each node during the operation was the child node itself.
So here was my first implementation:
letnode=rootwhilenode.child?node=deletenode.child
Considering the documentation, I would expect it to work.
we see that the problem comes from the order of the operations: the node variable is assigned before the property is deleted, but here we wanted to delete a property of node.
This has been done this way to avoid a temporary variable I guess.
In the case I shew, there is a simple workaround, using an implicit variable acting as the missing temporary variable: the that reference coming from the test.
The title was hard to find for me, to make it clear and concise, but actually the problem is simple.
Whether this is a good practice or not, here is what I've done:
During one of my developments, I tried to do something I often do which is recursively traversing a tree from the root to the leaves, removing some properties on each node.
Here the tree had a simple from:
Simple right?
Now the problem comes from the fact that the property I wanted to remove on each node during the operation was the child node itself.
So here was my first implementation:
Considering the documentation, I would expect it to work.
However, looking at the compiled JavaScript:
we see that the problem comes from the order of the operations: the
node
variable is assigned before the property is deleted, but here we wanted to delete a property ofnode
.This has been done this way to avoid a temporary variable I guess.
In the case I shew, there is a simple workaround, using an implicit variable acting as the missing temporary variable: the
that
reference coming from the test.However I think this is an issue, or otherwise change the documentation to be clear on this fact.
The text was updated successfully, but these errors were encountered: