Skip to content
Advertisement

Fetching all the available microphones – Map is not a function

I have the following code to fill up a select with the available microphones

JavaScript

I’m getting the error

JavaScript

Why doesn’t map work here?

Advertisement

Answer

getConnectedDevices is an async function, meaning that it returns a Promise instead of an array. You can use the .then function to update the list when the Promise is fulfilled.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement