var num = 2; var exp = 10; var count = 1; var result = 1; //2 в 0 while (count <= exp) { result *= num; count++; } alert(result); alert(Math.pow(2, 10));