Got an issue. Need to put full name from array as ID of LI element. ATM it takes only first word for some reason.could you help?
const buddiesNames = ['RGX 11z Pro Buddy', 'Zedd Buddy', 'Get Carried Buddy', 'In A Bind Buddy', 'Year One Buddy'];
ulForBuddyNames.innerHTML = buddiesNames
.map(
(elem) =>
`<li " class="valorantHeroBuddy"><a href="#" onClick="showCharacterBuddy(event)" id=${elem}> ${elem}<a/></li>`
)
.join('');
Can't have spaces in an id. Try replacing them with a hyphen: elem.replace(/\s+/, '-')
id's value must not contain whitespace (spaces, tabs etc.). Browsers treat non-conforming IDs that contain whitespace as if the whitespace is part of the ID. In contrast to the class attribute, which allows space-separated values, elements can only have one single ID value.
var ulForBuddyNames = document.querySelector('div');
const buddiesNames = ["RGX 11z Pro Buddy", "Zedd Buddy", "Get Carried Buddy", "In A Bind Buddy", "Year One Buddy"];
ulForBuddyNames.innerHTML = buddiesNames.map(elem => `<li class="valorantHeroBuddy"><a href="#" onClick="showCharacterBuddy(event)" id=${elem.replace(/\s+/, '-')}> ${elem}<a/></li>`).join("");
<div></div>