Learn Form Validation by Building a Calorie Counter - Step 34

Tell us what’s happening:

Hi, I’m stuck at this phase, please help, not sure what’s going on here, thanks!

Your code so far

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

/* file: styles.css */

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

function isInvalidInput(str) {
  const regex = /\d+e\d+/i;
  const result = str.match(regex);



}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Learn Form Validation by Building a Calorie Counter - Step 34

@erezjacobofer the instruction says you should return the result

1 Like

Thanks but I still don’t understand how to do this.

Look at your previous function further up in the code for an example of how to return the result

2 Likes

Hi, you must be use this:

–removed–
you must return directly with the .match function the matches using the regular expression stored in “regex”. and don’t need create a “const” with the result.

Hi and welcome to the forum :wave:

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like