See very little practical use for this but still interesting technique! If I used
let{length,[length-1]:last}=list;
I would just shock all my coworkers and would throw them off, instead of
letlength=list.length;letlast=list[length-1];
This technique could really come in handy when need to grab two items out of a list at the same time though. That's a place I'd really consider using it, like with the
let{0:a,1:b}=list;returna>b;
...or whatever. Well got me pondering of how to use it, very interesting. Thanks for sharing! :)
See very little practical use for this but still interesting technique! If I used
I would just shock all my coworkers and would throw them off, instead of
This technique could really come in handy when need to grab two items out of a list at the same time though. That's a place I'd really consider using it, like with the
...or whatever. Well got me pondering of how to use it, very interesting. Thanks for sharing! :)
To be fair you can do that last example as
Which is way shorter. It would make sense perhaps for getting items from the end of a list, but as you say not very legible.
Oh yea forgot about that trick! The most interesting thing about this technique is to find where to use it.