get and set javascript object values using dynamic keys