My problem is this, I have an array of colored objects and it is as follows: [Color [id = 1, CodeColor = Red], Color [id = 2, CodeColor = Green]] And I need to go through that array of colors through the jquery library and paint it in an option of a select, I have tried this code but it gives the following error:
function Color(id, codigoOColor) {
this.id = id,
this.codigoOColor = codigoOColor
}
function mostrarColores(){
$.each(colores, function(color){
let html = '<option>${color.id}</option>';
$("#ejemploColor").append(html);
});
}
mostrarColores();
Can not use 'in' operator to search for 'length' in [Color [id = 1, CodeColor = Red], Color [id = 2, CodeColor = Green]]