Looking to create a JavaScript function for a button that will hide certain ID elements and show others simultaneously. I've come up with a code snippet, but it's not working as expected. Given my limited experience with JavaScript, it's highly likely that there are errors in my code.
function mlbShowTeamsMap() {
document.getElementById("mlbTeamsMap").style.display = "block";
document.getElementById("mlbTeamsList").style.display = "block";
var mlbOther = ["nflTeamsList", "nflTeamsMap", "nhlTeamsList", "nhlTeamsMap", "nbaTeamsList", "nbaTeamsMap"];
mlbOther.forEach(hide);
function hide() {
style.display = "none";
}
}