Reputation: 18278
Given data such :
var json = [
{ "id": "A", "status": 1, "rank": 30, "score": 0.1 },
{ "id": "B", "status": 1, "rank": 30, "score": 0.7 },
{ "id": "C", "status": 1, "rank": 60, "score": 0.8 },
{ "id": "AB", "status": 1, "rank": 160, "score": 0.6 },
{ "id": "ABC", "status": 1, "rank": 400, "score": 0.2 }
];
How to get the id's length ?
Fiddle: http://jsfiddle.net/RBSC9/
The following doesn't works:
var l = (json[3].id).text().length();
console.log("l = "+ l );
Upvotes: 1
Views: 2367
Reputation: 2604
Please refer the update fiddle link http://jsfiddle.net/RBSC9/3/
var l = (json[3].id).length
You want to mention length
like length;
not length();
Upvotes: 1
Reputation: 3215
Use *.lenght
var l = json[3].id.length;
console.log("length["+json[3].id+"] = "+ l );
Upvotes: 1