Mitch Mitch - 1 year ago 51
jQuery Question

How do I set names.x

I want to know how to set x names in a option variable.

var names = {};

and then set
names.{username from event (e.user.username)} = 1;

Answer Source

You can use bracket notation to pass variable as key.

var username = 'Lorem';
var names = {};

names[username] = 1;