I'm trying out the node-mysql module on node js. What I want to do is to be able to come up with an object like this:
{'room1':'Room 1','room2':'Room 2','room3':'Room 3'}
Here's the code:
var boom = results;
var rooms = [];
var index = 0;
var name = 'session';
for(var b in boom){
var ses = name + index;
rooms[b] = {ses : boom[b]['ses_title']};
index++;
}
The ses variable is being treated as a string in the code above. And I end up with something like this:
[{ses : 'class session'} , {ses : 'team session'}]