js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Given the following object, create a method that outputs the students like in the description #412

Closed odv closed 4 years ago

odv commented 4 years ago
let group = {
  title: "Our Group",
  students: ["John", "Pete", "Alice"],
};

Name your method "showList" and format the output to be(use a forEach loop): Our Group: John Our Group: Pete Our Group: Alice

RazvanBugoi commented 4 years ago
let group = {
  title: "Our Group",
  students: ["John", "Pete", "Alice"],
  showList() {
    this.students.forEach(( element) => console.log(`${this.title}: ${element}`));
}
};