Regex pattern returns true, while inside function returns false
Hello everyone,
I am working on a little project to dive deeper into HTML,CSS and Javascript and I came across rpoblem in one of my functions, where I use a fully working regex pattern. I tested it in console.log, it always returns true for the strings i am checking.
Here is the pattern:
Now my function in which i am using it always returns true, according to console.log.
Here is the code for the function:
Is there something I don't understand here, because when i run the following if statement or simply logging the
Here is how i checked:
I am working on a little project to dive deeper into HTML,CSS and Javascript and I came across rpoblem in one of my functions, where I use a fully working regex pattern. I tested it in console.log, it always returns true for the strings i am checking.
Here is the pattern:
Now my function in which i am using it always returns true, according to console.log.
Here is the code for the function:
Is there something I don't understand here, because when i run the following if statement or simply logging the
validateFirstName function, it returns false, regardless the regex pattern.Here is how i checked:
