I am implementing a code where if the received variable does not contain a value it should be done for
, otherwise not.
Well, if it were for the "simple" case, it was just to implement the if
with the conditions and mount the for
according to the result, but that would make the code very large. So I would like to know if it's possible to do the following in JavaScript.
<script language="javascript">
w_valor_1;
w_valor_2;
if(w_valor_1 == ""){
w_for_1 = "for(i = 0; i < w_b; i++){";
w_ch_1 = "}";
}
else{
i = w_valor_1;
w_for_1 = "";
}
if(w_valor_2 == ""){
w_for_2 = "for(j = 0; j < w_c; j++){";
w_ch_2 = "}";
}
else{
j = w_valor_2;
w_for_2 = "";
}
w_for_1;
w_for_2;
m_valores[i][j] = b++;
w_ch_2;
w_ch_1;
</script>