Guest User

Untitled

a guest
Jun 25th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. const studentData = [
  2. {
  3. name: 'Tim',
  4. status: 'Current student',
  5. course: 'Biology',
  6. },
  7. {
  8. name: 'Sue',
  9. status: 'Withdrawn',
  10. course: 'Mathematics',
  11. },
  12. {
  13. name: 'Liz',
  14. status: 'On leave',
  15. course: 'Computer science',
  16. },
  17. ];
  18.  
  19. function enrollInSummerSchool(students) {
  20. /*1. create an array*/
  21. const studentsArray = [];
  22. /*2. Go through each object in given array of students */
  23. for (let i = 0; i < students.length; i++) {
  24. /*Update the value for each 'status' key */
  25. Object.assign({status : 'In Summer school'});
  26. /*populate newly created array */
  27. studentsArray.push(students[i])
  28. };
  29. return studentsArray;
  30. }
Add Comment
Please, Sign In to add comment