Skip to content

Commit

Permalink
Format code-blocks in arrays concept so ... (#1085)
Browse files Browse the repository at this point in the history
* Format code-blocks in arrays concept so they look nicer on the site.

* Format the code
  • Loading branch information
SleeplessByte authored Apr 11, 2021
1 parent 64f7d9c commit f8b335b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"[markdown]": {
"editor.wordWrap": "on",
"editor.rulers": [
// This is the cut-off on the website for most code blocks if they are
// displayed to a user. The rulers at 80 and 120 make less sense here
// because of how whitespace is (not) rendered.
65
]
}
}
20 changes: 11 additions & 9 deletions concepts/arrays/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ names[1];
Arrays can also be created using the constructor syntax, but for most uses, the array literal syntax is recommended.

```javascript
const names = new Array()
names.push('Jack', 'Laura', 'Paul', 'Megan')
const names = new Array();
names.push('Jack', 'Laura', 'Paul', 'Megan');

names[1];
// => Laura
Expand All @@ -30,22 +30,24 @@ const names = ['Jack', 'Laura', 'Paul', 'Megan'];
names.length;
// => 3

// Properties can be set on arrays using bracket ['property'] or dot .property
// notation, and this will affect the length, as shown below.
// Properties can be set on arrays using bracket ['property'] or
// dot .property notation, and this will affect the length, as
// shown below.

names.magician = 'Elyse';
names.length;
// => 4

// The property shows up when logging the array, making it seem that the
// property is somehow incorporated in the array.
// The property shows up when logging the array, making it seem
// that the property is somehow incorporated in the array.

names;
// => ["Jack", "Laura", "Paul", "Megan", magician: "Elyse"]

// However, be aware. Properties added via non-numeric keys are NOT part of the
// array's internal list, and are not traversed or mutated when using one of
// the traversal or mutation operations.
// However, be aware. Properties added via non-numeric keys are
// NOT part of the array's internal list, and are not traversed
// or mutated when using one of the traversal or mutation
// operations.

names.forEach((name) => console.log(name));
// => Jack
Expand Down

0 comments on commit f8b335b

Please sign in to comment.