logo CodeStepByStep logo

jsonMystery1

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

Consider the following JSON-formatted object:

let miniJSON = {
    "foo" : ["b", 1, 2],
    "bar" : 0,
    "FOO" : "Foo?"
};

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.

miniJSON.foo
miniJSON."foo"
miniJSON[foo]
miniJSON["FOO"]
miniJSON.foo[0]
miniJSON["FOO"][1]
miniJSON["foo"].length
miniJSON["FOO"].length

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.