Can a varying-length if-else statement be converted to a for loop in Javascript?
I have the following code which includes a varying number (nk) of if-else conditions. var n = 128; // n is 128 or greater. var nk = 4; // nk is varying, can be 4,6,8,12,16 etc. smaller than n. for…