I want to create a json object in node.js that looks like this;
{ WantThisName: { property_length: 8 } }
Here is my code;
var property_name = "WantThisName"
var length = 8;
var Obj_bin;
Obj_bin= {property_name: {property_length:length} };
console.log (Obj_bin);
The console output is;
{ property_name: { property_length: 8 } }
The problem lies with property_name
not getting the contents of the variable property_name
.