It depends entirely on what room.getParticipants() would return in the JavaScript version. But to try to point you the right direction in converting that code: You're probably going to want getParticipants to return either an ES2015 (aka "ES6") Map (if you can rely on ES2015+ features) or an object (typically used for what you use Map for in Java prior to ES2015).
If you're relying on ES2015+ features and have it return a Map, then 
for (const entry of room.getParticipants().entries()) {
    addParticipant(entry[1]);
}
If you're limiting yourself to ES5 and earlier and have it return an object (typically used as maps prior to ES2015), then
var participants = room.getParticipants();
for (var key in participants) {
    addParticipant(participants[key]);
}
There's lots of great information (reference, tutorial, etc.) on the Mozilla Developer Network site.