how to use the variable in a for loop in Javascript?
===

I have a dataTable which I need to iterate through. so I have this code:


    var tableSize = $('#j_idt11\\:dataTable tbody tr').length;
    					
    						
    						
    					for(i = 0;i< tableSize;i++){
    						var test1 = document.getElementById("j_idt11:dataTable:0:updFoodType").textContent;
    						if(test1 == "food")
    							alert("hey");
    					}

but I really want to use the i in the for loop. I thought something like this:

    var tableSize = $('#j_idt11\\:dataTable tbody tr').length;

					
						
						
					for(i = 0;i< tableSize;i++){
						var test1 = document.getElementById("j_idt11:dataTable:[i]:updFoodType").textContent;
						if(test1 == "food")
							alert("hey");
					}


but that doesn't work. how must I use the syntax? Thanks!