Infinite loop


#1

var ans=2;
var loop = function(){
while(ans<10){
ans*2;
console.log("i'm looping!");

}

};

loop();


#2

Yes this code will yield an infinite loop. Because the value of ans is never changing in memory hence ans will always be less than 10
You need to store ans*2 in ans using the = operator