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?

If you do not understand how to solve an exercise or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect tests, etc.), please

Is there a problem? Contact a site administrator.

©, all rights reserved.