When to while and when to for infinite loop,


#1

for(var i = 0; i <11; i++){
console.log(i)
}
var t = 0
while(t = 1){
console.log("Why won't this stupid goddamn thing work!?!?!?")
}

This is my code. I'm getting a infinite loop over and over and over again even though the while condition is never even met.


#2

You are assigning t to 1. You compare with ==.