Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我尝试
escape('/')
它只是返回相同的东西。是否有一些功能可以逃避'/'?
我认为你的意思是你想对它进行urlencode。尝试 encodeURIComponent('/');
encodeURIComponent('/');
或者,如果在正则表达式中使用它,您可以在它前面加上\.
\
foo.test(/\black\/white/) // foo = 'black/white'