loading...

re: Destructuring arrays as objects VIEW POST

TOP OF THREAD FULL DISCUSSION
re: See very little practical use for this but still interesting technique! If I used let { length, [length-1]: last } = list; I would just shock...
 

To be fair you can do that last example as

 let [a,b] = list
 return a > b

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.

code of conduct - report abuse