What`s wrong with my code?


#1

var myBag= ["cake";"choclate";"sweet"];
for (var i=myBag; i console.log (myBag[i]);
};
var j=0;
while(j console.log (myBag[j++]);
};
var
do h= 0;
{
console.log (myBag[h++]);
}
while(h };


#2

How to say this nicely? I don't even know where to start what is wrong.
let's start with line 1:

var myBag= ["cake";"choclate";"sweet"];

items in array are separated by comma's (,) not semi-colons (;)
your for loop is a mess, normal for loop:

for (var i = 0; i < myBag.length; i++){}

i could go on, your while condition is weird. You don't use console.log in while (), while is used to check if the loop needs to be executed again