From d7ca38bf47fccbe2ea1248a0db10824c60891ef5 Mon Sep 17 00:00:00 2001 From: alvynmcq Date: Sat, 14 Nov 2015 22:50:41 +0000 Subject: [PATCH] Bad code in a Waypoint snippet #4434 Replaced .map() method with .forEach() --- challenges/json-apis-and-ajax.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/challenges/json-apis-and-ajax.json b/challenges/json-apis-and-ajax.json index 5d3b0a5e6f..7e8200980e 100644 --- a/challenges/json-apis-and-ajax.json +++ b/challenges/json-apis-and-ajax.json @@ -160,14 +160,14 @@ "title": "Convert JSON Data to HTML", "description": [ "Now that we're getting data from a JSON API, let's display it in our HTML.", - "We can use the .map() method to loop through our data and modify our HTML elements.", + "We can use the .forEach() method to loop through our data and modify our HTML elements.", "First, let's declare an html variable with var html = \"\";.", "Then, let's loop through our JSON, adding more HTML to that variable. When the loop is finished, we'll render it.", "Here's the code that does this:", - "json.map(function(val) {", + "json.forEach(function(val) {", "  var keys = Object.keys(val);", "  html += \"<div class = 'cat'>\";", - "  keys.map(function(key) {", + "  keys.forEach(function(key) {", "    html += \"<b>\" + key + \"</b>: \" + val[key] + \"<br>\";", "  });", "  html += \"</div><br>\";",