Modifying the DOM (Document Object Model) as you traverse it risks making the loop highly resource-expensive, especially in terms of CPU usage. An infinite loop, which consumes a huge amount of resources, might be generated if we add elements at the same time as we traverse it. It is thus highly recommended to NOT perform such edits.
Avoid:
<script>
$('a.extlink').each(function(el) {
$(el).attr('rel', 'external nofollow');
});
</script>