Answers for "add object to object dynamically"

0

add object to object dynamically

const b = 'b';
const c = 'c';

const data = {
    a: true,
    [b]: true, // dynamic property
    [`interpolated-${c}`]: true, // dynamic property + interpolation
    [`${b}-${c}`]: true
}
Posted by: Guest on June-10-2021

Code answers related to "add object to object dynamically"

Browse Popular Code Answers by Language