本文讲解javascript去掉代码里面的注释
reg = /("([^\"]*(\.)?)*")|('([^\']*(\.)?)*')|(/{2,}.*?(r|n|$))|(/*(n|.)*?*/)/g; script.replace(reg, function(word) { // 去除注释后的文本 return /^/{2,}/.test(word) || /^/*/.test(word) ? "" : word; });
本文讲解javascript去掉代码里面的注释
reg = /("([^\"]*(\.)?)*")|('([^\']*(\.)?)*')|(/{2,}.*?(r|n|$))|(/*(n|.)*?*/)/g; script.replace(reg, function(word) { // 去除注释后的文本 return /^/{2,}/.test(word) || /^/*/.test(word) ? "" : word; });