You need to use this in a different way:
console.log($rootScope.wg["variable" + 1]);
The reason is,
variable1 is not the same as
This is called as accessing
key of an
$rootScope.wg is the object in the question.