Skip to content

Instantly share code, notes, and snippets.

View borisStanojevic's full-sized avatar

Boris Stanojevic borisStanojevic

View GitHub Profile
@borisStanojevic
borisStanojevic / addPropertyConditionallyOnObject.js
Last active February 24, 2021 23:55
Add property on an object conditionally
const someCondition = 9 % 2 !== 0;
const someObject = {
standardProperty: "X",
...(someCondition && { conditionalProperty: "Y" })
};