diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/6538830e01ab66ade75b869e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/6538830e01ab66ade75b869e.md index 2257dace260..4fa72cc6a02 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/6538830e01ab66ade75b869e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/6538830e01ab66ade75b869e.md @@ -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(); diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/6538855514cb16b10204e712.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/6538855514cb16b10204e712.md index f44a0b50f42..a48315193cd 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/6538855514cb16b10204e712.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/6538855514cb16b10204e712.md @@ -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. diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/653887098bdc39b3684a51c8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/653887098bdc39b3684a51c8.md index 91adac79378..fc1b024a7c0 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/653887098bdc39b3684a51c8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/653887098bdc39b3684a51c8.md @@ -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)); diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388762f61f44b3fd490a4a.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388762f61f44b3fd490a4a.md index ffed05bfa62..32716c45f70 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388762f61f44b3fd490a4a.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388762f61f44b3fd490a4a.md @@ -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)); diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388bbcbf6928b83fc424d1.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388bbcbf6928b83fc424d1.md index c4590a649dd..05f35485200 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388bbcbf6928b83fc424d1.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388bbcbf6928b83fc424d1.md @@ -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", () => { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388edfdf364fbb04e426f2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388edfdf364fbb04e426f2.md index ff6953e59a7..1bce9afd764 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388edfdf364fbb04e426f2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65388edfdf364fbb04e426f2.md @@ -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 } diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389211a8d86bbd876a2a74.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389211a8d86bbd876a2a74.md index 02993fa4aad..135adcd0742 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389211a8d86bbd876a2a74.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389211a8d86bbd876a2a74.md @@ -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-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/653898fa7eee37c57b960e35.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/653898fa7eee37c57b960e35.md index bd71851d497..5cf63d0bb92 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/653898fa7eee37c57b960e35.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/653898fa7eee37c57b960e35.md @@ -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) { @@ -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-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389a63d3b1d6c764c0e10e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389a63d3b1d6c764c0e10e.md index 5211c541ba6..5369f65e1f7 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389a63d3b1d6c764c0e10e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389a63d3b1d6c764c0e10e.md @@ -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-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389de504d0f2ca10e92a57.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389de504d0f2ca10e92a57.md index 85d6fe3c758..6f4b0c831aa 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389de504d0f2ca10e92a57.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389de504d0f2ca10e92a57.md @@ -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)`/; diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389eff4893facbbe6eae67.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389eff4893facbbe6eae67.md index 929a891c071..7d1c058e5d4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389eff4893facbbe6eae67.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-the-date-object-by-building-a-date-formatter/65389eff4893facbbe6eae67.md @@ -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));