I would like to know if it possible to deconstruct (in my case x) an array and create an alias in order to avoid issues with reserved keywords.
Here an example, but it gives me an error. Any idea how to solve it? Thanks
const mk = (data) =>
data.map((x, idx) => {
const [a, b, for:xxx, d] = x
return {
a,
b,
for:xxx, // I want create an object with for property name
d
}
})
{ "for": xxx }const [a, b, for:xxx, d] = xwithconst [a, b, xxx, d] = x. jsfiddle.net/6974zk8o