Let we have the following object with students:
let students = {
'group1': ['student11', 'student12', 'student13'],
'group2': ['student21', 'student22', 'student23'],
'group3': ['student31', 'student32'],
};
Let's add one more student to the first group:
students.group1.push('student14');
Let's now make one more, fourth group and add a student to it. To do this, you first need declare the new group as an array:
students.group4 = [];
And only then you can add students to it:
students.group4.push('student41');
Copy to yourself the following structure to store a to-do list for specific dates:
let affairs = {
'2019-12-28': ['data11', 'data12', 'data13'],
'2019-12-29': ['data21', 'data22', 'data23'],
'2019-12-30': ['data31', 'data32', 'data33'],
}
Add one more data-item to the
date '2019-12-29'
.
Add two more data-items to the
date '2019-12-31'
.
Copy to yourself the following structure to store the list of students:
let students = {
'group1': {
'subgroup11': ['student111', 'student112', 'student113'],
'subgroup12': ['student121', 'student122', 'student123'],
},
'group2': {
'subgroup21': ['student211', 'student212', 'student213'],
'subgroup22': ['student221', 'student222', 'student223'],
},
'group3': {
'subgroup31': ['student311', 'student312', 'student313'],
'subgroup32': ['student321', 'student322', 'student323'],
},
};
Add a new student to the subgroup
'subgroup11'
.
Add one more subgroup to the first group.
Make the fourth group, make a subgroup in it and add two new students to it.