forループを実行せずにjavascriptの配列内の要素にアクセスしたい。
これが私の配列です:
var array = [{
"title": "Warnings",
"numbers": 30,
"content": [{
"number": 3001,
"description": "There may be a problem with the device you are using if you use the default profile"
}]
}, {
"title": "Errors",
"numbers": 20,
"content": [{
"number": 1000,
"description": "No network is loaded"
}]
}]
forループを実行せずに「警告」の「コンテンツ」属性にアクセスしたい.アクセスするために現在行っていることは次のとおりです。
var content;
for(a in array) {
if(a.title == "Warnings") {
content = a.content;
break;
}
}
それは javascript で実行可能なものですか?