Learn the Date Object by Building a Date Formatter - Step 21

Tell us what’s happening:

Not sure what I’m doing wrong and I might be overthinking it. “You should add a break statement within the case after your logic.” I also tried removing semicolon before adding break; but I still get the same message.

Your code so far

 switch (dateOptionsSelectElement.value) {
    case "yyyy-mm-dd": 
      currentDateParagraph.textContent = formattedDate 
        .split("-") 
        .reverse()
        .join("-"); 
        break;        
  }

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Challenge Information:

Learn the Date Object by Building a Date Formatter - Step 21

Hi there and welcome to our community!

Your code looks correct to me but there may be an error elsewhere.
Could you post your full code please?

You have two extra spaces, one after the split method and one after the join method.

I’m guessing a regex is used that won’t match with the spaces in the code.

Must have been a cookies error because when I logged back in and redid the task it was fine.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.