Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript, dynamic variable, and function to add data to O

//code that allows for dynamic Variables - with unique names - to be made

var obj = {};
//==========================
function makeDynamic(str, data){
    obj[str] = data;
    return obj;
}

function addData(str, data2){
    obj[str] += 'hello';
    console.log('obj', obj); 
}
 
PREVIOUS NEXT
Tagged: #dynamic #function #add #data #O
ADD COMMENT
Topic
Name
3+5 =