How to destructure object properties with key names that are invalid variable names?

const data = {
   "key-with-dash": ["BAZ"]
}

const {"key-with-dash": foo} = data;

console.log("foo", foo);

Leave a Comment