I have the following statements in my Lightning component's Javascript controller:
console.log(/.*/.test("asd")); // prints "false"
console.log(/(.*)/.test("asd")); // prints "true"
When I run the exact same commands in the browser's console, they both print true
. Of course, since they're semantically the same.
What is happening?
Best Answer
The reason for this seems to be that the framework replaces the first line's asterisk character with the
\u002A
Unicode escape sequence before serving the files to the browser.I'd report a bug if it was possible. Hopefully someone here can raise the issue!