diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.english.md
index 6e5e88ba5c..91adf1afe9 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.english.md
@@ -11,8 +11,8 @@ We have an array of objects representing different people in our contacts lists.
A lookUpProfile
function that takes name
and a property (prop
) as arguments has been pre-written for you.
The function should check if name
is an actual contact's firstName
and the given property (prop
) is a property of that contact.
If both are true, then return the "value" of that property.
-If name
does not correspond to any contacts then return "No such contact"
-If prop
does not correspond to any valid properties of a contact found to match name
then return "No such property"
+If name
does not correspond to any contacts then return "No such contact"
.
+If prop
does not correspond to any valid properties of a contact found to match name
then return "No such property"
.
## Instructions
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.english.md
index 77caae1f59..701a8f23af 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.english.md
@@ -9,7 +9,7 @@ videoUrl: 'https://scrimba.com/c/cyWJBT4'
In the previous challenge, you used a single conditional operator
. You can also chain them together to check for multiple conditions.
The following function uses if, else if, and else statements to check multiple conditions:
-function findGreaterOrEqual(a, b) {
if(a === b) {
return "a and b are equal";
}
else if(a > b) {
return "a is greater";
}
else {
return "b is greater";
}
}
+function findGreaterOrEqual(a, b) {
if (a === b) {
return "a and b are equal";
}
else if (a > b) {
return "a is greater";
}
else {
return "b is greater";
}
}
The above function can be re-written using multiple conditional operators
:
function findGreaterOrEqual(a, b) {
return (a === b) ? "a and b are equal" : (a > b) ? "a is greater" : "b is greater";
}
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.english.md
index c2d268a49c..a03069bc61 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.english.md
@@ -13,7 +13,7 @@ For example:
With the var
keyword, i
is declared globally. So when i++
is executed, it updates the global variable. This code is similar to the following:
var numArray = [];
var i;
for (i = 0; i < 3; i++) {
numArray.push(i);
}
console.log(numArray);
// returns [0, 1, 2]
console.log(i);
// returns 3
This behavior will cause problems if you were to create a function and store it for later use inside a for loop that uses the i
variable. This is because the stored function will always refer to the value of the updated global i
variable.
-var printNumTwo;
for (var i = 0; i < 3; i++) {
if(i === 2){
printNumTwo = function() {
return i;
};
}
}
console.log(printNumTwo());
// returns 3
+var printNumTwo;
for (var i = 0; i < 3; i++) {
if (i === 2) {
printNumTwo = function() {
return i;
};
}
}
console.log(printNumTwo());
// returns 3
As you can see, printNumTwo()
prints 3 and not 2. This is because the value assigned to i
was updated and the printNumTwo()
returns the global i
and not the value i
had when the function was created in the for loop. The let
keyword does not follow this behavior:
'use strict';
let printNumTwo;
for (let i = 0; i < 3; i++) {
if (i === 2) {
printNumTwo = function() {
return i;
};
}
}
console.log(printNumTwo());
// returns 2
console.log(i);
// returns "i is not defined"
i
is not defined because it was not declared in the global scope. It is only declared within the for loop statement. printNumTwo()
returned the correct value because three different i
variables with unique values (0, 1, and 2) were created by the let
keyword within the loop statement.
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.english.md
index a4ba4adfa0..414a204baf 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword.english.md
@@ -49,7 +49,7 @@ function printManyTimes(str) {
// change code below this line
var sentence = str + " is cool!";
- for(var i = 0; i < str.length; i+=2) {
+ for (var i = 0; i < str.length; i+=2) {
console.log(sentence);
}
@@ -75,7 +75,7 @@ function printManyTimes(str) {
// change code below this line
const SENTENCE = str + " is cool!";
- for(let i = 0; i < str.length; i+=2) {
+ for (let i = 0; i < str.length; i+=2) {
console.log(SENTENCE);
}
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.english.md
index b94cee0c02..565f924673 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.english.md
@@ -8,7 +8,7 @@ challengeType: 1
In the last challenge, you learned about export default
and its uses. It is important to note that, to import a default export, you need to use a different import
syntax.
In the following example, we have a function, add
, that is the default export of a file, "math_functions"
. Here is how to import it:
-import add from "math_functions";
add(5,4); //Will return 9
+import add from "math_functions";
add(5,4); // Will return 9
The syntax differs in one key place - the imported value, add
, is not surrounded by curly braces, {}
. Unlike exported values, the primary method of importing a default export is to simply write the value's name after import
.
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.english.md
index 023181dc1d..576f5da510 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.english.md
@@ -8,7 +8,7 @@ challengeType: 1
As seen in the previous challenge, const
declaration alone doesn't really protect your data from mutation. To ensure your data doesn't change, JavaScript provides a function Object.freeze
to prevent data mutation.
Once the object is frozen, you can no longer add, update, or delete properties from it. Any attempt at changing the object will be rejected without an error.
-let obj = {
name:"FreeCodeCamp",
review:"Awesome"
};
Object.freeze(obj);
obj.review = "bad"; //will be ignored. Mutation not allowed
obj.newProp = "Test"; // will be ignored. Mutation not allowed
console.log(obj);
// { name: "FreeCodeCamp", review:"Awesome"}
+let obj = {
name:"FreeCodeCamp",
review:"Awesome"
};
Object.freeze(obj);
obj.review = "bad"; // will be ignored. Mutation not allowed
obj.newProp = "Test"; // will be ignored. Mutation not allowed
console.log(obj);
// { name: "FreeCodeCamp", review:"Awesome"}
## Instructions
@@ -51,7 +51,7 @@ function freezeObj() {
// change code above this line
try {
MATH_CONSTANTS.PI = 99;
- } catch( ex ) {
+ } catch(ex) {
console.log(ex);
}
return MATH_CONSTANTS.PI;
@@ -80,7 +80,7 @@ function freezeObj() {
// change code above this line
try {
MATH_CONSTANTS.PI = 99;
- } catch( ex ) {
+ } catch(ex) {
console.log(ex);
}
return MATH_CONSTANTS.PI;
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.english.md
index 7c0ae8fda6..3f28f6ccda 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.english.md
@@ -11,7 +11,7 @@ This is to be noted, that the class
syntax is just a syntax, and no
In ES5, we usually define a constructor function, and use the new
keyword to instantiate an object.
var SpaceShuttle = function(targetPlanet){
this.targetPlanet = targetPlanet;
}
var zeus = new SpaceShuttle('Jupiter');
The class syntax simply replaces the constructor function creation:
-class SpaceShuttle {
constructor(targetPlanet){
this.targetPlanet = targetPlanet;
}
}
const zeus = new SpaceShuttle('Jupiter');
+class SpaceShuttle {
constructor(targetPlanet) {
this.targetPlanet = targetPlanet;
}
}
const zeus = new SpaceShuttle('Jupiter');
Notice that the class
keyword declares a new function, and a constructor was added, which would be invoked when new
is called - to create a new object.
Notes:
- UpperCamelCase should be used by convention for ES6 class names, as in
SpaceShuttle
used above.
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.english.md
index acf3e446fa..e661040c98 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.english.md
@@ -8,7 +8,7 @@ challengeType: 1
We can similarly destructure nested objects into variables.
Consider the following code:
-const a = {
start: { x: 5, y: 6},
end: { x: 6, y: -9 }
};
const { start : { x: startX, y: startY }} = a;
console.log(startX, startY); // 5, 6
+const a = {
start: { x: 5, y: 6 },
end: { x: 6, y: -9 }
};
const { start: { x: startX, y: startY }} = a;
console.log(startX, startY); // 5, 6
In the example above, the variable startX
is assigned the value of a.start.x
.
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.english.md
index 087f3de7b2..5784c63527 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.english.md
@@ -9,11 +9,11 @@ challengeType: 1
We saw earlier how spread operator can effectively spread, or unpack, the contents of the array.
We can do something similar with objects as well. Destructuring assignment is special syntax for neatly assigning values taken directly from an object to variables.
Consider the following ES5 code:
-var voxel = {x: 3.6, y: 7.4, z: 6.54 };
var x = voxel.x; // x = 3.6
var y = voxel.y; // y = 7.4
var z = voxel.z; // z = 6.54
+var voxel = { x: 3.6, y: 7.4, z: 6.54 };
var x = voxel.x; // x = 3.6
var y = voxel.y; // y = 7.4
var z = voxel.z; // z = 6.54
Here's the same assignment statement with ES6 destructuring syntax:
const { x, y, z } = voxel; // x = 3.6, y = 7.4, z = 6.54
If instead you want to store the values of voxel.x
into a
, voxel.y
into b
, and voxel.z
into c
, you have that freedom as well.
-const { x : a, y : b, z : c } = voxel; // a = 3.6, b = 7.4, c = 6.54
+const { x: a, y: b, z: c } = voxel; // a = 3.6, b = 7.4, c = 6.54
You may read it as "get the field x
and copy the value into a
," and so on.
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-reuse-a-code-block.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-reuse-a-code-block.english.md
index dcbae80d67..84c2454e24 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-reuse-a-code-block.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-reuse-a-code-block.english.md
@@ -8,7 +8,7 @@ challengeType: 1
In the previous challenge, you learned about import
and how it can be leveraged to import small amounts of code from large files. In order for this to work, though, we must utilize one of the statements that goes with import
, known as export. When we want some code - a function, or a variable - to be usable in another file, we must export it in order to import it into another file. Like import
, export
is a non-browser feature.
The following is what we refer to as a named export. With this, we can import any code we export into another file with the import
syntax you learned in the last lesson. Here's an example:
-const capitalizeString = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
}
export { capitalizeString } //How to export functions.
export const foo = "bar"; //How to export variables.
+const capitalizeString = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
}
export { capitalizeString } // How to export functions.
export const foo = "bar"; // How to export variables.
Alternatively, if you would like to compact all your export
statements into one line, you can take this approach:
const capitalizeString = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
}
const foo = "bar";
export { capitalizeString, foo }
Either approach is perfectly acceptable.
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.english.md
index 1e9dad6b7c..9e91fd3a03 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.english.md
@@ -10,7 +10,7 @@ You can obtain values from an object, and set a value of a property within an ob
These are classically called getters and setters.
Getter functions are meant to simply return (get) the value of an object's private variable to the user without the user directly accessing the private variable.
Setter functions are meant to modify (set) the value of an object's private variable based on the value passed into the setter function. This change could involve calculations, or even overwriting the previous value completely.
-class Book {
constructor(author) {
this._author = author;
}
// getter
get writer(){
return this._author;
}
// setter
set writer(updatedAuthor){
this._author = updatedAuthor;
}
}
const lol = new Book('anonymous');
console.log(lol.writer); // anonymous
lol.writer = 'wut';
console.log(lol.writer); // wut
+class Book {
constructor(author) {
this._author = author;
}
// getter
get writer() {
return this._author;
}
// setter
set writer(updatedAuthor) {
this._author = updatedAuthor;
}
}
const lol = new Book('anonymous');
console.log(lol.writer); // anonymous
lol.writer = 'wut';
console.log(lol.writer); // wut
Notice the syntax we are using to invoke the getter and setter - as if they are not even functions.
Getters and setters are important, because they hide internal implementation details.
Note: It is a convention to precede the name of a private variable with an underscore (_
). The practice itself does not make a variable private.
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-rest-operator-with-function-parameters.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-rest-operator-with-function-parameters.english.md
index 89d9b11f67..c73748fa2c 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-rest-operator-with-function-parameters.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-the-rest-operator-with-function-parameters.english.md
@@ -8,7 +8,7 @@ challengeType: 1
In order to help us create more flexible functions, ES6 introduces the rest operator for function parameters. With the rest operator, you can create functions that take a variable number of arguments. These arguments are stored in an array that can be accessed later from inside the function.
Check out this code:
-function howMany(...args) {
return "You have passed " + args.length + " arguments.";
}
console.log(howMany(0, 1, 2)); // You have passed 3 arguments
console.log(howMany("string", null, [1, 2, 3], { })); // You have passed 4 arguments.
+function howMany(...args) {
return "You have passed " + args.length + " arguments.";
}
console.log(howMany(0, 1, 2)); // You have passed 3 arguments.
console.log(howMany("string", null, [1, 2, 3], { })); // You have passed 4 arguments.
The rest operator eliminates the need to check the args
array and allows us to apply map()
, filter()
and reduce()
on the parameters array.
@@ -44,7 +44,7 @@ tests:
```js
const sum = (x, y, z) => {
- const args = [ x, y, z ];
+ const args = [x, y, z];
return args.reduce((a, b) => a + b, 0);
}
console.log(sum(1, 2, 3)); // 6
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements/index.md
index aa654367bd..563c3061c2 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements/index.md
@@ -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';
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/counting-cards/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/counting-cards/index.md
index 2c3bfe01ed..a639a7787f 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/counting-cards/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/counting-cards/index.md
@@ -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:
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements/index.md
index 822ca595a0..de4eada73f 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements/index.md
@@ -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;
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/profile-lookup/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/profile-lookup/index.md
index 7c9607c0ce..358d602db2 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/profile-lookup/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/profile-lookup/index.md
@@ -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];
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/record-collection/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/record-collection/index.md
index 3768f0e9d2..3800751c82 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/record-collection/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/record-collection/index.md
@@ -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 {
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch/index.md
index 45c3e452af..89e8894768 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch/index.md
@@ -11,7 +11,7 @@ Here’s 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;
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements/index.md
index 0ca16c2b91..eec0e73ad3 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements/index.md
@@ -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;
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups/index.md
index 44e21ab438..5d64a39f7d 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups/index.md
@@ -12,7 +12,7 @@ function phoneticLookup(val) {
var result = "";
// Only change code below this line
- switch(val) {
+ switch (val) {
case "alpha":
result = "Adams";
break;
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword/index.md
index 7d72818c66..96cf5cd3a0 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/es6/declare-a-read-only-variable-with-the-const-keyword/index.md
@@ -38,7 +38,7 @@ Change all the variables to `let` or `const` and rename `sentence`.
function printManyTimes(str) {
"use strict";
const SENTENCE = str + " is cool!";
- for(let i = 0; i < str.length; i+=2) {
+ for (let i = 0; i < str.length; i+=2) {
console.log(SENTENCE);
}
}
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/es6/prevent-object-mutation/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/es6/prevent-object-mutation/index.md
index ae5ab2c7d3..ec019d5a09 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/es6/prevent-object-mutation/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/es6/prevent-object-mutation/index.md
@@ -31,7 +31,7 @@ _You need to freeze the `MATH_CONSTANTS` object so that no one is able to alter
try {
MATH_CONSTANTS.PI = 99;
- } catch( ex ) {
+ } catch(ex) {
console.log(ex);
}
return MATH_CONSTANTS.PI;
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object/index.md
index 8926addde4..799005f0ce 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object/index.md
@@ -31,14 +31,14 @@ function makeClass() {
"use strict";
/* Alter code below this line */
- class Thermostat{
- constructor(fahrenheit){
+ class Thermostat {
+ constructor(fahrenheit) {
this.fahrenheit = fahrenheit;
}
- get temperature(){
+ get temperature() {
return 5 / 9 * (this.fahrenheit - 32);
}
- set temperature(celsius){
+ set temperature(celsius) {
this.fahrenheit = celsius * 9.0 / 5 + 32;
}
}
diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions/index.md
index daa68e4223..00b51f4fc0 100644
--- a/guide/english/certifications/javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions/index.md
+++ b/guide/english/certifications/javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions/index.md
@@ -35,7 +35,7 @@ We need to compute and square values from the `realNumberArray` and store them i
```javascript
const squareList = (arr) => {
"use strict";
- const squaredIntegers = arr.filter( (num) => num > 0 && num % parseInt(num) === 0 ).map( (num) => Math.pow(num, 2) );
+ const squaredIntegers = arr.filter((num) => num > 0 && num % parseInt(num) === 0).map((num) => Math.pow(num, 2));
return squaredIntegers;
};