+ 2
The cycle does not pass three times
https://code.sololearn.com/W5zSb9hmu845/?ref=app It is necessary to ask a question three times and write the answers in an array.
4 ответов
+ 3
dont use i to store prompt input, just create a new one.
or at least use let i, so i from the loop not modified
+ 6
Taste it's worked, thank you🙂
+ 3
var shopGoods = [];
for(var i=0; i<=2; i++){
var x=prompt('Какой тип товаров продаете?');
shopGoods.push(x);
}
console.log(shopGoods);
правильно так?
+ 2
using same var name could work with let
for(let i=0; i<=2; i++){
let i=prompt
even though its working, it doesnt mean you should use it. for clarity purpose use different variable name like x in your new code