Good tip, I actually use something similar for moderating posts. A couple of tips:
1. As donshakespeare said you can use the "delete hidden posts" button on the Admin > Stats page, which will delete all of them.
2. In your code you can actually shorten that to remove "each" as jQuery applies functions to all matching elements by default. You can also do click() instead of using trigger. Example:
$('.qa-form-light-button-delete').click();
3. Depending on your server settings "clicking" 50+ posts simultaneously may not work or it may overload your server. You can use slice() to click a limited amount. In this method you should also use ":visible" in the selector because when deleting posts the HTML is only hidden in the page, not removed entirely (until you reload the page). If you run it twice on the same page it will try and click the deleted posts again. This will delete the first 10 posts that have not been deleted:
$('.qa-form-light-button-delete:visible').slice(0,10).click();
For the moderation page, I first skim over the posts and approve any real posts. Then I run this to reject all the spam:
$('.qa-q-list-item:visible .qa-form-light-button-reject').slice(0,10).click();