Código
var materias = []; function agregarMateria(){ var materia_txt = document.getElementById("mat_add").value; materias.push([materia_txt,"valido","valido"]); recargaSelect(); materia_txt.value=""; } function recargaSelect(){ var select_my = document.getElementById("list_mats"); select_my.innerHTML = ""; var option_default = document.createElement("option"); option_default.text = "Todos(Seleccióna)"; option_default.value = "valido"; select_my.add(option_default); for (var i = 0; i<= materias.length; i++) { var aux_arreglo = materias[i]; if(aux_arreglo[1]=="valido" && aux_arreglo[2]=="valido"){ //ESTA LINEA ME DA ERROR var option = document.createElement("option"); option.text = aux_arreglo[0]; option.value = aux_arreglo[0]; select_my.add(option); } } }