Skip to content

Commit

Permalink
Merge pull request #633 from freeCodeCamp/main
Browse files Browse the repository at this point in the history
Create a new pull request by comparing changes across two branches
  • Loading branch information
GulajavaMinistudio authored Nov 17, 2023
2 parents 94c03ee + 452fe04 commit 050f54d
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dashedName: step-4

The `Date` object has a number of methods that allow you to get the date and time in different formats.

One of those is the `.getDate()` method, which returns a number between 1-31 that represents the day of the month for that date. For example:
One of those is the `.getDate()` method, which returns a number between `1` and `31` that represents the day of the month for that date. For example:

```js
const date = new Date();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dashedName: step-8

# --description--

The `.getMinutes()` method returns a number between 0 and 59 which represents the minutes for the provided date.
The `.getMinutes()` method returns a number between `0` and `59` which represents the minutes for the provided date.

Create a `const` variable named `minutes` and assign it the minutes from `date` with the `.getMinutes()` method.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ After the `day` variable, add a dash (`-`) followed by another embedded expressi

# --hints--

You will need to use the `month` constant inside the template literal after a dash.
You should add a dash followed by the `month` constant to the template literal.

```js
assert(code.match(/const\s+formattedDate\s+=\s+`\${day}\s*-\s*\${month}`/g));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ After the `month` variable, add a dash followed by another embedded expression t

# --hints--

You will need to use the `year` constant inside the template literal after a dash.
You should add a dash followed by the `year` constant to the template literal.

```js
assert(code.match(/const\s+formattedDate\s+=\s+`\${day}\s*-\s*\${month}\s*-\s*\${year}`/g));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dashedName: step-15

# --description--

In JavaScript, the `change` event is used to detect when the value of an HTML element has changed.
In JavaScript, the `change` event is used to detect when the value of an HTML element has changed:

```js
element.addEventListener("change", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ dashedName: step-17

When the user chooses the `Year, Month, Day` option from the dropdown, the date format should reflect this choice.

To do this, you can add a `case` in the `switch` statement, followed by your logic.
To do this, you can add a `case` clause in the `switch` statement that checks for a match against the expression `expr`, followed by code to run if there's a match. Here's an example where the `case` clause checks that `expr` is equal to the string `case123`:

```js
switch (expression) {
switch (expr) {
case 'case123':
// Write your logic here
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ dashedName: step-18

# --description--

In JavaScript, the `.split()` method is used to split up a string into an array of substrings. This method has an optional separator parameter, which indicates where each split should happen.

```js
"coca-cola".split("-"); // [ 'coca', 'cola' ]
```

Split `formattedDate` into an array of substrings with the `.split()` method and use a `"-"` as the separator.

# --hints--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dashedName: step-21

If your `switch` statement is going to have multiple cases, it is best practice to include a `break` statement.

The `break` statement will tell the JavaScript interpreter to stop executing statements. Without adding a `break` statement at the end of each `case` block, the program will execute the code for all matching `cases`.
The `break` statement will tell the JavaScript interpreter to stop executing statements. Without adding a `break` statement at the end of each `case` block, the program will execute the code for all matching `cases`:

```js
switch (someVariable) {
Expand All @@ -26,7 +26,7 @@ Add a `break` statement to the end of your `case` block.
You should add a `break` statement within the `case` after your logic.

```js
assert(code.match(/break/g));
assert(code.match(/\.join\((['"])-\1\)\;?\n+\s*break/g));
```

# --seed--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ assert(code.match(/case\s*(['"])mm-dd-yyyy-h-mm\1\s*:\s*currentDateParagraph.tex
You should include a `break` statement within the `case` after your logic.

```js
assert(code.match(/break/g));
assert(code.match(/currentDateParagraph.textContent\s*=\s*``\;?\n+\s*break/g));
```

# --seed--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Inside the `case` for `mm-dd-yyyy-h-mm`, set the `textContent` property of `curr

# --hints--

You should assign `${month}-${day}-${year} ${hours} Hours ${minutes} Minutes` inside the `textContent` property of the `currentDateParagraph` constant.
You should assign `${month}-${day}-${year} ${hours} Hours ${minutes} Minutes` to the `textContent` property of `currentDateParagraph`.

```js
const pattern = /case\s*(['"])mm-dd-yyyy-h-mm\1\s*:\s*currentDateParagraph\.textContent\s*=\s*`(\$\{month}-\$\{day}-\$\{year} \$\{hours} Hours \$\{minutes} Minutes)`/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ And with that, your date formatter is complete! You can now format the current d

# --hints--

You should use the `default` case to set the `textContent` property of `currentDateParagraph` equal to the constant `formattedDate`.
You should use the `default` case to set the `textContent` property of `currentDateParagraph` to the value of `formattedDate`.

```js
assert(code.match(/default\s*:\s*currentDateParagraph.textContent\s*=\s*formattedDate/g));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ A `team lead` is a person who leads or manages a team. In the dialogue, Maria in

## --blanks--

team
`team`

### --feedback--

Focus on the term Maria used to describe herself.

---

lead
`lead`

### --feedback--

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Maria is introducing herself and confirming Tom's job role. `Are` is used in the

## --blanks--

are
`are`

### --feedback--

Expand Down

0 comments on commit 050f54d

Please sign in to comment.