I can create a dynamic object as follows:
var year=2103;
var month=9;
var selected={};
selected[year][month]=true;
But the following gives an undefined object error I presume because the first key has not been created and Javascript is not automatically doing that.
selected[year]=true;