Stack Based | Easy to Understand | Faster than 99% | JavaScript Solution
\nvar minRemoveToMakeValid = function(str) {\n    str = str.split("");\n\tlet stack = [];\n    for(let i = 0; i<str.length; i++){\n        if(str[i]==="(")\n   
```\nvar minRemoveToMakeValid = function(str) {\n    str = str.split("");\n\tlet stack = [];\n    for(let i = 0; i<str.length; i++){\n        if(str[i]==="(")\n            stack.push(i);\n        else if(str[i]===")"){\n            if(stack.length) stack.pop();\n            else str[i]="";\n        }\n    }\n    \n    for(let i of stack) str[i] = "";\n    \n    return str.join("");\n\t\n}\n```\n\n**I hope that you\'ve found the solution useful.**\n*In that case, please do upvote and encourage me to on my quest to document all leetcode problems\uD83D\uDE03*\nPS: Search for **mrmagician** tag in the discussion, if I have solved it, You will find it there\uD83D\uDE38\n\n**This is by far my most upvoted solution \uD83C\uDF89 ! Thanks Guys \uD83D\uDC9A**
['JavaScript']