Skip to content

Commit

Permalink
Merge branch 'exercism:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
meatball133 authored Sep 22, 2023
2 parents c45f0ff + 95ee3a4 commit 9f35761
Show file tree
Hide file tree
Showing 486 changed files with 4,866 additions and 3,401 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/action-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
steps:
- name: 'Post acknowledgement that it will format code'
continue-on-error: true # Never fail the build if this fails
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -34,7 +34,7 @@ jobs:
id: fork_status
run: |
IS_FORK="$(jq '.head.repo.fork' "/tmp/pr.json")"
echo "::set-output name=fork::$IS_FORK"
echo "fork=$IS_FORK" >> "$GITHUB_OUTPUT"
- name: 'Setup SSH deploy key'
if: steps.fork_status.outputs.fork == 'false'
Expand All @@ -60,10 +60,10 @@ jobs:
git clone $HEAD_REPO .
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"
- name: Use Node.js LTS (16.x)
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
- name: Use Node.js LTS (18.x)
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: '16'
node-version: '18'
- name: Install project development dependencies
run: npm install --no-save
- name: 'Format code'
Expand All @@ -88,11 +88,11 @@ jobs:
- name: 'Post acknowledgement that it has formatted the code'
continue-on-error: true # Never fail the build if this fails
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -102,11 +102,11 @@ jobs:
- name: 'Post reminder to trigger build manually'
continue-on-error: true # Never fail the build if this fails
if: steps.fork_status.outputs.fork == 'true'
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/action-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
steps:
- name: 'Post acknowledgement that it will sync exercises'
continue-on-error: true # Never fail the build if this fails
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -34,7 +34,7 @@ jobs:
id: fork_status
run: |
IS_FORK="$(jq '.head.repo.fork' "/tmp/pr.json")"
echo "::set-output name=fork::$IS_FORK"
echo "fork=$IS_FORK" >> "$GITHUB_OUTPUT"
- name: 'Setup SSH deploy key'
if: steps.fork_status.outputs.fork == 'false'
Expand Down Expand Up @@ -84,11 +84,11 @@ jobs:
- name: 'Post acknowledgement that it has synced the code'
continue-on-error: true # Never fail the build if this fails
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -98,11 +98,11 @@ jobs:
- name: 'Post reminder to trigger build manually'
continue-on-error: true # Never fail the build if this fails
if: steps.fork_status.outputs.fork == 'true'
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- name: Use Node.js LTS (16.x)
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
- name: Use Node.js LTS (18.x)
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: '16'
node-version: '18'

- name: Install project dependencies
run: npm ci
Expand All @@ -29,12 +29,12 @@ jobs:

strategy:
matrix:
node-version: ['16', '17', '18']
node-version: ['18', '20']

steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: ${{ matrix.node-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pr.ci.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:

steps:
- name: Checkout PR
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac

- name: Use Node.js LTS (16.x)
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
- name: Use Node.js LTS (18.x)
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: '16'
node-version: '18'

- name: Install project dependencies
run: npm ci
Expand All @@ -33,14 +33,14 @@ jobs:

strategy:
matrix:
node-version: ['16', '17', '18']
node-version: ['18', '20']

steps:
- name: Checkout PR
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: ${{ matrix.node-version }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/verify-code-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout code'
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b
- name: Use Node.js LTS (16.x)
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
- name: Use Node.js LTS (18.x)
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: '16'
node-version: '18'
- name: Install project development dependencies
run: npm i
- name: 'Verify formatting of all files'
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LICENSE

# These are formatted via configlet and will not match prettier
exercises/**/.meta/config.json
exercises/**/.approaches/config.json
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

[![configlet](https://github.com/exercism/javascript/workflows/configlet/badge.svg)](https://github.com/exercism/javascript/actions?query=workflow%3Aconfiglet) [![javascript / main](https://github.com/exercism/javascript/workflows/javascript%20/%20main/badge.svg)](https://github.com/exercism/javascript/actions?query=workflow%3A%22javascript+%2F+main%22)

⚠️ We 💙 our community but **this repository does not accept community contributions at this time**.
There are no active maintainers to review PRs.
Please read this [community blog post][freeing-maintainers] for details. ⚠️

**Exercism exercises in JavaScript**

This is the JavaScript track, one of the many tracks on [Exercism][web-exercism].
Expand Down Expand Up @@ -93,3 +97,4 @@ A lot of the improvements made to this track and tooling are also made to the Ty
[git-typescript-representer]: https://github.com/exercism/typescript-representer
[git-typescript-test-runner]: https://github.com/exercism/typescript-test-runner
[git-website-copy]: https://github.com/exercism/website-copy
[freeing-maintainers]: https://exercism.org/blog/freeing-our-maintainers
4 changes: 2 additions & 2 deletions concepts/array-transformations/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ arr.reduce(

return accumulator;
},
{ even: [], odd: [] }
{ even: [], odd: [] },
);
// => { even: [2, 4], odd: [1, 3] }
```
Expand All @@ -81,7 +81,7 @@ This method modifies the array it is called on.

### slice (pure)

Given a start and an end index, creates a sub-array from the array passed as a parameter.
Given a start and an end index, creates a sub-array from the array it is called on.

The element at the end index will not be included.
Also, all parameters are optional:
Expand Down
4 changes: 2 additions & 2 deletions concepts/array-transformations/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ arr.reduce(

return accumulator;
},
{ even: [], odd: [] }
{ even: [], odd: [] },
);
// => { even: [2, 4], odd: [1, 3] }
```
Expand All @@ -81,7 +81,7 @@ This method modifies the array it is called on.

### slice (pure)

Given a start and an end index, creates a sub-array from the array passed as a parameter.
Given a start and an end index, creates a sub-array from the array it is called on.

The element at the end index will not be included.
Also, all parameters are optional:
Expand Down
2 changes: 1 addition & 1 deletion concepts/arrays/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The array's object properties and list of array elements are separate, and the a
```javascript
const names = ['Jack', 'Laura', 'Paul', 'Megan'];
names.length;
// => 3
// => 4

// Properties can be set on arrays using bracket ['property'] or
// dot .property notation, and this will affect the length, as
Expand Down
33 changes: 28 additions & 5 deletions concepts/null-undefined/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,38 @@ That means while `null` represents an empty value (but still a value), `undefine
`undefined` appears in different contexts.

- If a variable is declared without a value (initialization), it is `undefined`.

```js
let name;
console.log(name); // => undefined
```

- If you try to access a value for a non-existing key in an object, you get `undefined`.

```js
let obj = {
name: 'John',
};
console.log(obj.age); // => undefined
```

- If a function does not return a value, the result is `undefined`.

```js
function printName(name) {
'My name is ' + name;
}
console.log(printName('John')); // => undefined
```

- If an argument is not passed to a function, it is `undefined`, unless that argument has a default value.

```javascript
let name;
console.log(name);
// => undefined
```
```js
function printName(name) {
return name;
}
console.log(printName()); // => undefined
```

You can check whether a variable is undefined using the strict equality operator `===`.

Expand Down
1 change: 1 addition & 0 deletions concepts/objects/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ obj[key];

Using the dot notation as a shorthand has the same restriction as omitting the quotation marks.
It only works if the key follows the identifier naming rules.
In other words, if your key is not a single word using only letters, you must use square bracket notation.

## Adding or Changing a Value

Expand Down
4 changes: 2 additions & 2 deletions concepts/promises/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Promise.reject(new Error('failed')).then(
},
function (error) {
console.error(error); // error in the console
}
},
);
```

Expand All @@ -127,7 +127,7 @@ Promise.resolve('resolved!').then(
},
function (value) {
// not called
}
},
);
```

Expand Down
2 changes: 1 addition & 1 deletion concepts/regular-expressions/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ _When to use one or the other?_ Use the `test()` when you want a fast way of che

### Test

The [test()][mdn-regex-test]] method executes a search for a match between a regular expression and a specified string. Returns true or false.
The [test()][mdn-regex-test] method executes a search for a match between a regular expression and a specified string. Returns true or false.

```javascript
const str = 'It is difficult to test if you have a virus';
Expand Down
Loading

0 comments on commit 9f35761

Please sign in to comment.