-1

我做了一个像这样的对象:

var courtdocument=    {
    'CFADocuments': {
        cv: [
            "CFA_Pack_Cover_Letter.docx",
            "Countersigned-CFA-Terms-and-Conditions-Letter.docx",
            "Test-cfa-documents - Copy - Copy.docx"
        ]
    },
    'LetterOfClaim': {
        cv: [
             "CFA_Pack_Cover_Letter.docx",
            "Countersigned-CFA-Terms-and-Conditions-Letter.docx"
        ]
    },
    'LetterOfInstruction': {
        cv: [
             "CFA_Pack_Cover_Letter.docx",
            "Countersigned-CFA-Terms-and-Conditions-Letter.docx"

        ]
    },
    Letters: {
        cv: [

        ]
    },
    'MedicalRecords': {
        cv: [

        ]
    },
    'medicalreports': {
        cv: [

        ]
    }
}

我将如何获得这一套?

CFADocuments
LetterOfClaim
LetterOfInstruction
Letters
MedicalRecords
medicalreports
4

3 回答 3

3

If you are looking for the different keys in the courtdocument obejct then in modern browsers you can use Object.keys() - IE < 9 not supported you can use a shim as shown in the mdn docs

console.log(Object.keys(courtdocument))

Demo: Fiddle

于 2013-11-06T09:21:49.123 回答
0

您只需要使用courtdocument.CFADocumentscourtdocument["CFADocuments"]

于 2013-11-06T09:20:41.170 回答
0

If you want to get the set of values, try:

var result = []

for (var prop in courtdocument){
    if (courtdocument.hasOwnProperty(prop){
        result.push(courtdocument[prop])
    }
}
于 2013-11-06T09:21:37.303 回答