Having some trouble understanding template literals in javascript, particularly the syntax. Whenever I run this loop, it seems to output extra commas between each iteration:
character = () => {
const traits = ["Knowledge", "Agility","Strength", "Charisma", "Perception", "Magical power"];
return `${traits.map(() => '')}`
};
Here's the full code snippet:
character = () => {
const dice = rndAssign(6, 16),
traits = ["Knowledge", "Agility","Strength", "Charisma", "Perception", "Magical power"];
return `<table>
<thead>
<tr>
<td> </td><td>D6</td><td>Mod</td>
</tr>
</thead>
<tbody>
${traits.map(elm => trait(elm))}
</tbody>
</table>`
};