I tried to do this with:
arr[i][j] = 'whatever';
but I get some kind of error “cannot convert to object…”
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.
I’m going to guess that you haven’t initialized
a[i]when you try to treat it like an array. If you haven’t initializeda[i]to be an array when you saya[i][j], then it will be undefined (or something else that isn’t an array or object) and that doesn’t know what[j]means, hence your “cannot convert to an object” error. You need something more like this: