Merge pull request #4442 from alvynmcq/staging
Typo in Waypoint Update Update the Properties of JS Objectpull/4477/head
commit
e2ca9c70ef
|
@ -743,7 +743,7 @@
|
|||
"<code>var ourDog = {</code>",
|
||||
"<code> \"name\": \"Camper\",</code>",
|
||||
"<code> \"legs\": 4,</code>",
|
||||
"<code> \"tails\": 1,</code>,",
|
||||
"<code> \"tails\": 1,</code>",
|
||||
"<code> \"friends\": [\"everything!\"]</code>",
|
||||
"<code>};</code>",
|
||||
"Since he's a particularly happy dog, let's change his name to \"Happy Camper\". Here's how we update his object's name property:",
|
||||
|
|
|
@ -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 <code>.map()</code> method to loop through our data and modify our HTML elements.",
|
||||
"We can use the <code>.forEach()</code> method to loop through our data and modify our HTML elements.",
|
||||
"First, let's declare an html variable with <code>var html = \"\";</code>.",
|
||||
"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:",
|
||||
"<code>json.map(function(val) {</code>",
|
||||
"<code>json.forEach(function(val) {</code>",
|
||||
"<code> var keys = Object.keys(val);</code>",
|
||||
"<code> html += \"<div class = 'cat'>\";</code>",
|
||||
"<code> keys.map(function(key) {</code>",
|
||||
"<code> keys.forEach(function(key) {</code>",
|
||||
"<code> html += \"<b>\" + key + \"</b>: \" + val[key] + \"<br>\";</code>",
|
||||
"<code> });</code>",
|
||||
"<code> html += \"</div><br>\";</code>",
|
||||
|
|
Loading…
Reference in New Issue