Getting user input for object property | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Getting user input for object property

please how can you make the user to specify the values of an object for example you have already create the age property but you want the user to input a value for the age just like it is used in variable (var age = prompt("your age"); function person (name, age, address) { this.name = name this.age = age this.address = address } I want the user to input their age by either using the prompt command or any available command

12th Aug 2017, 8:30 PM
Oluwaseun Ogunlana B.
Oluwaseun Ogunlana B. - avatar
2 Answers
0
When the user inputs their age, what will happen next? What will you do with the input you get from the user?
12th Aug 2017, 8:37 PM
Ghauth Christians
Ghauth Christians - avatar
0
I want it to store in the age variable of the object
13th Aug 2017, 6:09 PM
Oluwaseun Ogunlana B.
Oluwaseun Ogunlana B. - avatar