Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed typos in 'Destructing Arrays' section #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions readMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -3689,25 +3689,25 @@ Destructuring is a way to unpack arrays, and objects and assigning to a distinct
### Destructing Arrays

```js
const numbers = [1, 2,3];
const numbers = [1, 2, 3];
let [numOne, numTwo, numThree] = numbers;
console.log(numOne, numTwo, numThree) // 1,2,3
const names = ['Asabeneh', 'Brook', 'David', 'John']
let [firstPerson, secondPerson, ThirdPerson, fourth Person] = names;
const names = ['Asabeneh', 'Brook', 'David', 'John'];
let [firstPerson, secondPerson, ThirdPerson, fourthPerson] = names;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change ThirdPerson to thirdPerson

console.log(firstName, secondPerson,thirdPerson, fourthPerson) //Asabeneh, Brook, David, John
const scientificConstants = [2.72, 3.14, 9.81, 37, 100];
let [e, pi, gravity, bodyTemp, boilingTemp] = scientificConstants
let [e, pi, gravity, bodyTemp, boilingTemp] = scientificConstants;
console.log(e,pi,gravity, bodyTemp, boilingTemp) //2.72, 3.14, 9.81, 37, 100
```

If we like to skip on of the values in the array we use additional comma. The comma helps to omit the value at that index
If we like to skip one of the values in the array we use additional comma. The comma helps to omit the value at that index

```js
const numbers = [1, 2,3];
let [numOne, , , numThree] = numbers; //2 is omitted
console.log(numOne,, numThree) // 1,2,3
const names = ['Asabeneh', 'Brook', 'David', 'John']
let [, secondPerson, , fourth Person] = name; // first and third person is omitted
const numbers = [1, 2, 3];
let [numOne, , numThree] = numbers; //2 is omitted
console.log(numOne, numThree) // 1,2,3
const names = ['Asabeneh', 'Brook', 'David', 'John'];
let [, secondPerson, , fourthPerson] = names; // first and third person is omitted
console.log(secondPerson, fourthPerson) //Brook, John
```

Expand Down