javascript - How do i make an .append using a for loop in a <select> dropdown -


this have far getting error relating parentheses

var teachers = ['mrs ohara','mr decrenza','mrs poli']; $('#addteacher').on('click',function(){        $('#home').hide();       console.log();       $('#home').append('<select id = "teacherdropdown"><option>heloo</option></select>');       (var = 0;i++;i<teachers.length){         $('#teacherdropdown').append("<option value = "+teachers[i]+">"+teachers[i]+"</option>");       } }) 

you have condition wrong way around:

for (var = 0;i++;i<teachers.length) 

should be

for (var = 0;i<teachers.length;i++) 

working fiddle here: https://jsfiddle.net/qoxxjudp/