var tens = ['10','10','10','10','10','10','10','10'].map(parseInt); var ten = tens[tens.length-1]; var two = ten % 4; console.log(two + 2);