while (true) { let str = rand(1, 10); str === 1 ? break : alert(str); };
function rand(min,max){return Math.floor(Math.random()*(max-min+1))+min;}; [rand(1, 10)].map(function (value, index, mas) { mas = [rand(1, 10)]; if (value != 1) mas = []; alert(value); });