Menu
Coddy logo textTech

Recap - Basic Of Sets

Part of the Logic & Flow section of Coddy's JavaScript journey — lesson 35 of 65.

challenge icon

Challenge

Easy

Create a function called processStudentGroups that takes an array of student names as an argument. The function should:

  1. Create a Set from the input array to get unique student names
  2. Remove any student whose name starts with 'Z' (case insensitive)
  3. Add 'John Doe' to the Set if not already present
  4. Return an object with the following properties:
    • uniqueCount: The number of unique students
    • hasJohnDoe: A boolean indicating whether 'John Doe' is in the Set
    • studentsArray: An array of the final set of student names

Try it yourself

function processStudentGroups(students) {
  // Write your code here
}

All lessons in Logic & Flow