fibonacci sequence with while
06:30 25 May 2016

I tried to write fibonacci sequence in JS.

I could get result

var x = 0;
var y = 1;
var result = 0;
while (result<100){

result=x+y;
x = y;
y = result;
document.write("This is next number "+result+"
") } console.log(result)

I wonder if it is possible to get result with this while(total and count) loop like this one?

var total = 0, count = 1;
while(count <= 10){
total += count;
count += 1;
}
console.log(total);
javascript while-loop