I have a string and I want to iterate the .replace(re,'') until I achieve and empty sting "". How to do this rather than repeating over and over again the same method
var isValid = (s)=> {
const re = /(\(\))|(\[\])|(\{\})/gi
return s.replace(re,'').replace(re,'').replace(re,'').replace(re,'') !='' ? false :true
};
console.log(isValid("[({(())}[()])]"))