The code is very simple, mainly using regularity to implement it, and directly submit the code
reg = /("([^\\\"]*(\\.)?)*")|('([^\\\']*(\\.)?)*')|(\/{2,}.*?(\r|\n|$))|(\/\*(\n|.)*?\*\/)/g; (reg, function(word) { // Remove commented text return /^\/{2,}/.test(word) || /^\/\*/.test(word) ? "" : word; });
The above is the entire content of this article, I hope you like it.