I would transform the name of an object dynamically in string.
I would transform the name of the object in string to retrieve it dynamically. output desired:
"CartModel"
Currently it returns me
"[object Object]"
Here my object:
var CartModel= {
userID:{
beverage:{
// value
},
sandwich:{
},
treat:{
},
dessert:{
}
}
}
console.log('"' + CartModel + '"');
any hint would be great, thanks