【发布时间】:2013-07-03 11:59:39
【问题描述】:
给定数据:
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 }
];
如何获取id的长度?
小提琴:http://jsfiddle.net/RBSC9/
以下不起作用:
var l = (json[3].id).text().length();
console.log("l = "+ l );
【问题讨论】:
-
你在问如何获取字符串的长度???
-
是的...是错字。
标签: javascript jquery json string-length