<p id="demo"></p><script>var myObj, i, x = "";myObj = { "__type": "DocumentLibraryHelps.Methods.Instruction", "name": "IT-DSM-WI-003-RU_Управление BI Cloud_Ред.03.pdf", "url": "https://cloud.bi-group.org/instr/BI Cloud/IT-DSM-WI-003-RU_Управление BI Cloud_Ред.03.pdf?web=1", "type": "Microsoft.SharePoint.SPFile", "category": "Cloud", "section": "Cloud" }, { "__type": "DocumentLibraryHelps.Methods.Instruction", "name": "IT-DSM-WI-002-RU_Разграничение прав доступа к BI Cloud_Ред.02.pdf", "url": "https://cloud.bi-group.org/instr/BI Cloud/IT-DSM-WI-002-RU_Разграничение прав доступа к BI Cloud_Ред.02.pdf?web=1", "type": "Microsoft.SharePoint.SPFile", "category": "Cloud", "section": "Cloud" }, { "__type": "DocumentLibraryHelps.Methods.Instruction", "name": "Инструкция_Галерея.docx", "url": "https://cloud.bi-group.org/instr/Life/Инструкция_Галерея.docx?web=1", "type": "Microsoft.SharePoint.SPFile", "category": "ERP: Первые шаги", "section": "1C: ERP" };for (i = 0; i < myObj.cars.length; i++) { x += myObj.name[i] += myObj.url[i] += myObj.type[i] + "<br>";}document.getElementById("demo").innerHTML = x;</script>我通过使用 get 方法拥有该数组,我需要按类型在不同类别中按“for”编写?如何使用功能正确?我的错误在哪里?
3 回答

慕田峪4524236
TA贡献1875条经验 获得超5个赞
你的对象无效,这在你的第一个括号之后结束,当你改变它时,它应该循环
for(let obj in myObj){
}
并让你的 vals 更像 myObj[obj].type
添加回答
举报
0/150
提交
取消