Learn Form Validation by Building a Calorie Counter - Step 22

Tell us what’s happening:

I am having the following error:

SyntaxError: unknown: Expecting Unicode escape sequence \uXXXX.

This is the expected result:

Your regex variable should be set to the regular expression [±\s].

And this is my code:

function cleanInputString(str) {
  const regex = [+-\s];
}

I searched google and the forum, I also tried adding an additional backslash, single quotes and double quotes but I still get the same error, I hope someone can advise me

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function cleanInputString(str) {
  const regex = [+-\s];
}

// User Editable Region

Your browser information:

El agente de usuario es: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 22

Hi there! Look at the example again:

const regex = /[helo]/;

And at your code:

const regex = [+-\s];

Where are the slashes?

Thank you very much, sometimes it takes another look to notice the errors.

1 Like