Consider:
const obj = {
w: true,
a: true,
s: true,
d: true
};
Can we set all properties at once without repeating true
every line ?
And not something like this:
let obj = {};
obj.a = obj.w = obj.d = obj.w = true;
CodePudding user response:
Here's one way using Object.fromEntries