logo CodeStepByStep logo

jsonMystery2

Language/Type: JavaScript JSON objects
Author: Melissa Hovik (on 2018/10/22)

Consider the following JSON-formatted object:

let courses = {
    "CSE" : [
        { 142 : "CS1" },
        { 154 : "Web Programming" },
        { 311 : "Foundations to Computing" },
        { 404 : "History of Error Codes" }
    ],
    "BIO" : [
        { 200 : "Intro to Cellular Biology" },
        { 220 : "Animal and Plant Physiology" }
    ],
    "LING" : [
        { 100 : "Fundamentals of Grammar" }
    ]
};

Write the JavaScript value that would be returned for each of the following statements. Include "" around any string values. If any expression would result in an error, write error as your answer.

courses["LING"]
courses.length
courses["CSE"].length
courses[404]
courses["CS1"]
courses["CSE"][0][0]
courses["CSE"][1][154]
courses["BIO"][0][200][16]

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.