Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js add obj prop dynamically

const dynamicProp=shape';
const item={
    type:'solid',
    [dynamicProp]:'round',
}
//{type:'solid',shape:'round'}
console.log(item);|
 
PREVIOUS NEXT
Tagged: #js #add #obj #prop #dynamically
ADD COMMENT
Topic
Name
3+4 =