Object Property shorthand

PHOTO EMBED

Tue Jul 12 2022 09:37:40 GMT+0000 (Coordinated Universal Time)

Saved by @Harsh_S #array #object #destructure #parameter #arrowfunction

const getMousePosition = (x, y) => ({
  x: x,
  y: y
});

//can be written as
const getMousePosition = (x, y) => ({ x, y });
content_copyCOPY

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand