I want to calculate the factorial of 10 using a while loop, an if branch, and a break statement.
I manage to get the factorial of 10 with the while loop, but how can I get it using the if and break statement?
let x = 10;
var i = x-1;
while(i > 1){
x *= i;
i--;
}
console.log(x);