Fixing if/if else text in replacing if else chains with switch challenge

pull/9410/head
JamesWorsnop 2016-06-27 22:02:37 +09:00
parent 509819a91c
commit 187d4249fd
1 changed files with 2 additions and 2 deletions

View File

@ -3602,12 +3602,12 @@
"id": "56533eb9ac21ba0edf2244e0",
"title": "Replacing If Else Chains with Switch",
"description": [
"If you have many options to choose from, a <code>switch</code> statement can be easier to write than many chained <code>if</code>/<code>if else</code> statements. The following:",
"If you have many options to choose from, a <code>switch</code> statement can be easier to write than many chained <code>if</code>/<code>else if</code> statements. The following:",
"<blockquote>if (val === 1) {<br> answer = \"a\";<br>} else if (val === 2) {<br> answer = \"b\";<br>} else {<br> answer = \"c\";<br>}</blockquote>",
"can be replaced with:",
"<blockquote>switch (val) {<br> case 1:<br> answer = \"a\";<br> break;<br> case 2:<br> answer = \"b\";<br> break;<br> default:<br> answer = \"c\";<br>}</blockquote>",
"<h4>Instructions</h4>",
"Change the chained <code>if</code>/<code>if else</code> statements into a <code>switch</code> statement."
"Change the chained <code>if</code>/<code>else if</code> statements into a <code>switch</code> statement."
],
"releasedOn": "January 1, 2016",
"challengeSeed": [