我通常会发布到目前为止的代码,但我对此一无所知... :(
我将如何重新排序以下数组,以便我可以基于“百分比”键中的值,无论是从低到高还是从高到低?
var data = [{
"id": "q1",
"question": "blah blah blah",
"percentage": "32"
}, {
"id": "q2",
"question": "blah blah blah",
"percentage": "23"
}, {
"id": "q3",
"question": "blah blah blah",
"percentage": "11"
}, {
"id": "q4",
"question": "blah blah blah",
"percentage": "3"
}, {
"id": "q5",
"question": "blah blah blah",
"percentage": "6"
}]