Properties Inside Properties

So, I’m creating a bot in google app script and I got into a situation like this:

var user = "user1"
var id  = "01"
userdetail : user + ":" + id
getPropety(userdetail) //"user01:01" 

I was able to get a string("user01:01"), but I don’t want it so. Want it like this "user01":"01". So, is there way to change a string in to a code(?)?

P.S. The code above isn’t really precise but it doesn’t really matter, just a want give a breif idea.