//just copied this code from w3schools
var person={fname:"John",lname:"Doe",age:25};
for (x in person)
{
document.write(person[x] + " ");
}
I want to know that, what I have to assume instead of “x”.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
personis object andXis variable used in iteration of theforloop, you can name it anything other thanXalso :). HereXworks askeyof the object for example:Here
fnameis stored inXalong with other keys such aslnameandage.