What exactly is the [0]
in this bit of code?
Why is it there?
What does it do?
Thank you!
const form = document.getElementsByTagName('form')[0];
<form novalidate>
<p>
<label for="mail">
<span>Please enter an email address:</span>
<input type="email" id="mail" name="mail" required minlength="8">
<span class="error" aria-live="polite"></span>
</label>
</p>
<button>Submit</button>
</form>