我有一个数组,其中包含多个数组,每个数组包含多个对象,与此类似。
[[object1, object2],[object1],[object1,object2,object3]]
这是记录到控制台的对象的屏幕截图。
将其展平以便它只是一组对象的最佳方法是什么?
我试过这个没有运气:
console.log(searchData);
var m = [].concat.apply([],searchData);
console.log(m);
searchData 登出上面的截图,但 m 登出 [ ]
这是searchData的实际内容:
[[{"_id":"55064111d06b96d974937a6f","title":"Generic Title","shortname":"generic-title","contents":"<p>The Healing Center offers practical, social, and spiritual support to individuals and families. Services include, but are not limited to: food and clothing, job skills training and job search assistance, auto repair (Saturdays only), mentoring, financial counseling, tutoring, prayer, life skills training, and helpful information about local community services.</p><p>Stay in touch with us:</p>","__v":0},{"_id":"5508e1405c621d4aad2d2969","title":"test english","shortname":"test-page","contents":"<h2>English Test</h2>","__v":0}],[{"_id":"550b336f33a326aaee84f883","shortname":"ok-url","title":"now english","contents":"<p>okokko</p>","category":"Transportation","__v":0}]]