Part of that is actually a JavaScript idiom. zero in JS fails conditional checks, hence why the JS version of the above works:
```javascript
if (sortable_input.length) {
  sortable_input.val(destroy.is(':checked') ? '' : position++);
}