NodeList.prototype.forEach = Array.prototype.forEach; //... answer.forEach(function(e,i){ //... question.forEach(function(e,i){