let userActivity = {
id: 23894201352,
date: 'January 1, 2017',
data: {
totalUsers: 51,
online: 42
}
};
Take this object for example. If I wanted to set the ‘online’ property, don’t I have the choice to use either dot notation or bracket notation?
I sometimes have to try the possibilities to get it to work. So how do we alternate between using these notations? Are there any rules?
In the early challenges and so does now it’s stated that we can use both anytime
For this challenge I typed this to pass:
userActivity.data.online = 45;
What about this?
userActivity[data].online = 45;
or
userActivity[data][online] = 45;
What are all the correct forms?