I have the following array in JavaScript
("error", "No name entered", "Invalid Email", "No Message")
The array can also be
("success", "Your message has been sent.")
I would like to create a string that looks like this
<div class="error">
<ul>
<li>No Name entered</li>
<li>Invalid Email</li>
<li>No Message</li>
</ul>
</div>
The first item in the array is used for the div class the rest will be list items,
i've tried using formData[0], formData[1], etc. but that just prints undefined if the array item doesn't exist.
appendthe array elements while running it through a loop till the array length