If I understand correctly, what you want is this:
$.each(sizer,function(i,b){
props+=($(b).is(':checked')) ? i : 0;
});
There are two things for you to understand:
the syntax of the ternary operator is as follows:
condition ? expr1 : expr2
. Basicly it is a one-line if/else statement - if the condition is true - execute the first expression, otherwise execute the second expression. You can read more about it on the MDN docsMath.pow is a built-in javascript function that accepts two numbers - a number and a power of this number. So Math.pow(2, i) means 2 to the power of i. This is something you probably guessed by now.
It is very hard to help more than that, because I don't have the rest of the code at my disposal. For example, how can I know what are the values of sizer
? Etc...