Created
August 30, 2020 16:13
-
-
Save ashwinkumar2438/595f37af456081102d3fdc8f1146bba7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let x="abc"; | |
let re1=new RegExp(x); // output: /abc/ | |
let re2=/x/; // output: /x/ won't work as a variable in literal notation. | |
re1.test("abcdefg"); //true | |
re2.test("abcdefg"); //false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment