Instead of this `if` statement why not use `checkboxes.prop('checked', $(this).prop('checked'));``

It would simply the code.