Как сделать? JS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Как сделать? JS

Я не знаю как можно зациклить ввод данных чтобы проверялся возраст и пользователя добавляло к уже существующим То есть код проверяет возраст, если возраст подходит то добро пожаловать а если нет то должно писать что не подходите по возрасту https://code.sololearn.com/Wk6PcHfi3C7I/?ref=app

29th Oct 2020, 10:07 AM
Егор Лесков
9 Answers
+ 1
Sorry I don't understand what you mean by "loop it for new users" But as you said in your description, "That is, the code checks the age, if the age is suitable, then welcome, and if not, then it should write that it is not suitable for the age" correcting the above to p8.age does what you wanted
29th Oct 2020, 10:18 AM
Abhay
Abhay - avatar
+ 1
Егор Лесков as I said I don't really understand what you mean by "loop it for new users" ,what exactly you want to loop over? To be more precise can you give an example of the inputs and the respective outputs?
29th Oct 2020, 10:27 AM
Abhay
Abhay - avatar
+ 1
The user must enter 4 types of data: name, age, favorite color, favorite number. after which the code must check the age and if the user is under 18, the site does not skip it further, and if the user is 18+, then the user goes further to the site and adds it to the list of users along with his entered data. I do not know English very well, so I write via google translator
29th Oct 2020, 10:34 AM
Егор Лесков
+ 1
The it shouldn't it be , if (y>=18){ p8.changeName(x) p8.changeAge(y) p8.changefavColor(z) p8.changefavNumber(s); }
29th Oct 2020, 10:42 AM
Abhay
Abhay - avatar
0
It should be p8.age>=18 not p8>=18
29th Oct 2020, 10:13 AM
Abhay
Abhay - avatar
0
I did it myself, but how to loop it for new users?
29th Oct 2020, 10:15 AM
Егор Лесков
0
I know how to make it check the age and output the desired phrase, but I don't know how to loop it for new users
29th Oct 2020, 10:21 AM
Егор Лесков
0
Чтобы проверять возвраст можешь использовать следующий код https://code.sololearn.com/WiRB1ue1WdGG/?ref=app
18th Dec 2020, 5:40 AM
артур кириенко
0
Чтобы добавлять юсеров нужно учить sql
18th Dec 2020, 5:41 AM
артур кириенко