I think this post might help:
Split string into array of equal length strings
Applying it to your code, you could replace:
var arr = Array.prototype.slice.call(dna), output = [];
while (arr.length) output.push(arr.splice(0, 3).join('');
with:
var arr = text.match(/.{1,3}/g);