Add counter jquery

I have problem because I don’t know how to change code to add counter in name input. So when I will click #add_input new input will have name name[0], name[1] etc.

  $("#add_input").click(function () {
var html = '';
html += '<div class="row">';
html += '<input type="checkbox" name="name[0]">';
html += '</div></div>';
};