How to call HTML attribute ‘minlength’ in JavaSript

I have this code snippet:

<div>
      <label for="requiredSize">Required Size 5 : </label>
      <input type="text" name="requiredSize" id="requiredSize" class="required_size" minlength="5" />
</div>

I am doing a form validation exercise, and I need to have one of the requirements be based on required size. How can I call the minlength into my Javascript file to be used since it does change throughout the form.

I have tried documnet.querySelector("minlength") to try and save it as a variable, but it wasn’t being recognized.