课程: Level Up: JavaScript

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Classroom attendance

Classroom attendance

(bright music) - Destructuring is an expression which allows us to extract values from objects and arrays into variables. To destructure values from arrays we use square brackets and to destructure values from objects, we use curly brackets. The first variable declared in the brackets will receive the first array item as its value. The second variable will receive the second array item as its value and so on. You can use the spread operator, or three dots, to replace the remaining array or object values into one variable. For this challenge, you'll use array and object destructuring to return a list of students. Create a function called getStudents, which takes one argument, classroom. Classroom will contain a Boolean value, called hasTeachingAssistant, and class list which is an array of people in the classroom. The first value in class list will be the teacher. If has teaching assistant is true, the second value in…

内容