JavaScript
Result
Run
License
let reg = /foo/; // startsWith() 메소드는 인수로 정규식을 사용할 수 없으므로 TypeError가 발생한다. // macth 심벌을 프로퍼티로 지정하여 정규식으로 사용하지 않도록 설정한다. reg[Symbol.match] = false; // TypeError가 발생하지 않는다. let result = "/foo/".startsWith(reg); console.log(result);
Console
expand_less
License
License
by DevDic
Close