Hi I have the following code
const containsAtLeastDigits = (digits, password) => {
const regex = new RegExp(/(?=.{6}).*/g);
if (regex.test(password)) {
console.log("yes");
return false;
} else {
console.log("no");
}
};
containsAtLeastDigits(6, "abcdefg");
Here I have to pass the parameter digits where {6} is defined in regex as interpolation like this ${digits}. Can someone please explain if this is possible to do? I saw a few answers in StackOverflow itself but they are not working.