Answer the question
In order to leave comments, you need to log in
How to access the elements of a JavaScript array?
Here in this example:
var user = '{ "name": "Вася", "age": 35, "isAdmin": false, "friends": [0,1,2,3] }';
user = JSON.parse(user);
alert( user.friends[1] ); // 1
Answer the question
In order to leave comments, you need to log in
user.friends[1].thelocation
Do you read manuals at all? Well, at least what textbook ? Or a book ?
Update: I never cease to be amazed...
var users = [{ "thelocation" : "москва", "":""},{ "thelocation" : "london", "":""}];
console.log(users[1].thelocation);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question