showing results for - "javascript 2c dynamic variable 2c and function to add data to o"
Matteo
05 May 2019
1//code that allows for dynamic Variables - with unique names - to be made
2
3var obj = {};
4//==========================
5function makeDynamic(str, data){
6    obj[str] = data;
7    return obj;
8}
9
10function addData(str, data2){
11    obj[str] += 'hello';
12    console.log('obj', obj); 
13}