There are two variables in which data is written:
let finance = +prompt('Ваш бюджет?'); while (finance === "" || isNaN(finance) || finance === null) { let finance = prompt('Ваш бюджет?'); } let name = prompt('Название вашего магазина?'); while (name == "" || name == null) { let name = prompt('Название вашего магазина?'); } When entered into the first variable, everything is recorded without problems. The second one, too, but if, when entering into the second variable, first press Cancel or Ok and then enter without errors, it loops and the script does not go further, although the first variable works fine. What is the problem?
letinside the loop. - Stepan Kasyanenkofinanceloops in no less for the same reason. 2. Youfinanceresult in a number immediately (with the help of a unary plus), therefore comparisons withfinance === ""andfinance === nullmeaningless (if you enter and cancel, you have0). - Regentwindow.name, but with the scope of the variables. - Stepan Kasyanenko