Copy edits (#35536)

* Copy edits to Basic JavaScript section

* Copy edits to ES6 section

* Update index.md
This commit is contained in:
Amy Lam
2019-03-29 09:36:58 -07:00
committed by The Coding Aviator
parent 768b618e68
commit 914a7c522d
24 changed files with 39 additions and 39 deletions

View File

@ -11,7 +11,7 @@ title: Adding a Default Option in Switch Statements
function switchOfStuff(val) {
var answer = "";
switch(val){
switch (val){
case 'a': answer = 'apple';
break;
case 'b': answer = 'bird';

View File

@ -58,7 +58,7 @@ After you've counted the cards, use an `if` statement to check the value of **co
```javascript
function cc(card) {
// Only change code below this line
switch(card){
switch (card){
case 2:
case 3:
case 4:

View File

@ -7,7 +7,7 @@ title: Multiple Identical Options in Switch Statements
_If the break statement is omitted from a switch statement's case, the following case statement(s) are executed until a break is encountered. If you have multiple inputs with the same output, you can represent them in a switch statement like this:_
```javascript
switch(val) {
switch (val) {
case 1:
case 2:
case 3:
@ -37,7 +37,7 @@ You will need to have a case statement for each number in the range._
function sequentialSizes(val) {
var answer = "";
// Only change code below this line
switch(val) {
switch (val) {
case 1:
case 2:
case 3:
@ -67,7 +67,7 @@ sequentialSizes(1);
function sequentialSizes(val) {
var answer = "";
// Only change code below this line
switch(val){
switch (val){
case 1: case 2: case 3:
answer = "Low";
break;

View File

@ -56,7 +56,7 @@ Leave your `return "No such contact"` out of the `for` loop as a final catch-all
``` javascript
for (var x = 0; x < contacts.length; x++){
for (var x = 0; x < contacts.length; x++) {
if (contacts[x].firstName === name) {
if (contacts[x].hasOwnProperty(prop)) {
return contacts[x][prop];

View File

@ -55,7 +55,7 @@ To access the value of a key in this object, you will use `collection[id][prop]`
function updateRecords(id, prop, value) {
if (prop === "tracks" && value !== "") {
if(collection[id][prop]) {
if (collection[id][prop]) {
collection[id][prop].push(value);
}
else {

View File

@ -11,7 +11,7 @@ Heres the setup:
function chainToSwitch(val) {
var answer = "";
// Only change code below this line
switch(val) {
switch (val) {
case "bob":
answer = "Marley";
break;
@ -58,14 +58,14 @@ We need to change the chained ```if/else if``` statements into a ```switch``` st
Next, we need to create simple ```switch``` statement:
```javascript
switch(val) {
switch (val) {
}
```
and add in this ```switch``` statement ```case``` - for all ```if/else if``` statement (just copy it from our commented code above):
```javascript
switch(val) {
switch (val) {
case "bob":
answer = "Marley";
break;
@ -93,7 +93,7 @@ We need to change the chained ```if/else if``` statements into a ```switch``` st
function chainToSwitch(val) {
var answer = "";
// Only change code below this line
switch(val) {
switch (val) {
case "bob":
answer = "Marley";
break;

View File

@ -8,7 +8,7 @@ _If you have many options to choose from, use a `switch` statement. A `switch` s
_Here is a pseudocode example:_
```js
switch(num) {
switch (num) {
case value1:
statement1;
break;
@ -54,7 +54,7 @@ Do not see _"following conditions"_ as an ordered list as it looks in the origin
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch(val) {
switch (val) {
case 1:
return "alpha";
break;

View File

@ -12,7 +12,7 @@ function phoneticLookup(val) {
var result = "";
// Only change code below this line
switch(val) {
switch (val) {
case "alpha":
result = "Adams";
break;