0

undefined. I can't understand?

var name = prompt("Write your name: "); var age = prompt("type your age: "); function FucGetDate(){ var person = []; person[name]; person[age]; document.write(person[age]) } FucGetDate()

24th Jun 2016, 4:19 PM
cesar_cv velasquez
cesar_cv velasquez - avatar
3 Answers
+ 4
You have not assigned the name and age variables to your person array. Maybe you meant something like: person['name'] = name; person['age'] = age;
24th Jun 2016, 6:07 PM
James Flanders
+ 1
James is correct you need to assign the values of age and name to your array
24th Jun 2016, 9:52 PM
josh mizzi
josh mizzi - avatar
0
person[0]=name; person [1]=age;
6th Aug 2016, 7:05 AM
Petar Ivanov
Petar Ivanov - avatar