Destructuring by &reference

Andrea Giammarchi andrea.giammarchi at
Tue Mar 2 19:05:28 UTC 2021

Another one (cit. DJ Khaled)

has "by reference" ever been considered as "yet another JS syntax" ???

let object = {value: 1};
let {&value} = object;
value = 2;

object.value; // 2

allowed everywhere destructuring is possible, throwing for frozen
properties ... is this just meh? .. .'cause I think, specially for function
signatures declaration, it might make a difference, when mutability matters.

Cheers 👋

P.S. for transpilers this would simply carry, repeatedly, the initial
reference.prop around, instead of using just prop.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list