reg.test is not a function 报错

正则中  比如 var reg = "/^[0-9]$/" 会报  reg.test is not a function 
如果 var reg = /^[0-9]$/ 就不会有错 因为 这才是正则 正确的表达式
原文地址:https://www.cnblogs.com/hellozg/p/5764042.html