How to access attribute of object as a variable? Try like this: function getName(Object, name) { return Object[name]; }