docs.rodeo

MDN Web Docs mirror

Test your skills: JSON

The aim of this skill test is to assess whether you’ve understood our Working with JSON article.

[!NOTE] You can try solutions by downloading the code and putting it in an online editor such as CodePen, JSFiddle, or Glitch. If there is an error, it will be logged in the results panel on the page or into the browser’s JavaScript console to help you.

If you get stuck, you can reach out to us in one of our communication channels.

JSON 1

The one and only task in this article concerns accessing JSON data and using it in your page. JSON data about some mother cats and their kittens is available in sample.json. The JSON is loaded into the page as a text string and made available in the catString parameter of the displayCatInfo() function. Your task is to fill in the missing parts of the displayCatInfo() function to store:

The values of these variables are then printed to the screen inside paragraphs.

Some hints/questions:

Try updating the live code below to recreate the finished example:

{{EmbedGHLiveSample("learning-area/javascript/oojs/tasks/json/json1.html", '100%', 400)}} 

[!CALLOUT]

Download the starting point for this task to work in your own editor or in an online editor.

In this article

View on MDN