Js Regex Result Expression Assignment Issue
I have a js string, for example: 'h' + 'e' + 'l' + 'l' + 'o' which is being derived from a regex query. The string appears between [..] therefore I'm using the following to deriv
Solution 1:
The value you're storing in result
is actually a string that looks like:
'"h"+"e"+"l"+"l"+"o"'
Which is distinct from the expression"h"+"e"+"l"+"l"+"o"
; that expression is a series of string concatenations which evaluates to the string "hello"
.
Be cautious about using the output from console.log
as a definitive guide; it renders the given values in a way that aesthetically valuable, but not always precise.
I'm curious what you're actually trying to do.
Post a Comment for "Js Regex Result Expression Assignment Issue"