Please, i need help with this javascript code

The questions are viz;

  1. Create a displayUsers arrow function just above the fetchAndDisplayUsers function. It should take a users parameter
  2. It should use the array .forEach function to iterate over users and populate the SELECT UI element with OPTION elements. Each OPTION should have its value set to the id of a given user, while its display text should be set to the user’s name.

I’ve tried to write the following code but still giving error.

const displayUsers = (users) => {
    var parent = document.querySelector('select');
    
    users.forEach((user) => {
      var option = document.createElement('option');
      option.textContent = user.name;
      option.setAttribute("value",user.id);
      
      parent.appendChild(option);
    	
  	});
  }

Your help would be highly appreciated, thank you.

9 posts were merged into an existing topic: URGENT HELP: How do i build {specname}, (a simple BMI calculator application), with the below