Adding data to JavaScript object literature

This is my object literal:

var obj = {key1: value1}; 

How to add

 {key1: value1,value2,value3} 

to obj ?

+6
source share
1 answer

The value of your object must be an array or an object in which individual values ​​are stored, for example:

 {key1: [value1,value2,value3]} 

or

 {key1: new compositeValue(value1, value2, value3)} 
+7
source

Source: https://habr.com/ru/post/923403/


All Articles