考虑以下结构:
function repeatString(string, count) {
var num = 0;
var str = "";
if ( count === 0 ) {
return "";
}
while ( num < count ) {
num += 1;
str = str + string;
}
return str;
}
获得Level 3的所有子类别的最佳方法是什么?
这有效:
{
"name": "CatA",
"subcategories" : [
{
"name" : "SubCatA",
"subcategories" : [
{
"name" : "SubSubCatA",
"subcategories" : [
{
"name" : "SubSubSubCatA",
"subcategories" : [
]
}
]}]}]}
这是最有效的方式吗?