escape() Don't use it, as it has been deprecated since ECMAScript v3. encodeURI() Use encodeURI when you want a working URL. Make this call: encodeURI("http://www.google.com/a file with spaces.html") to get: http://www.google.com/a%20file%20with…
估计很多前端工程师并不清楚escape,encodeURI, encodeURIComponent的区别,也不知道什么时候该用哪个方法,以及这些方法为什么要被用到,下面我主要来阐述一下这三个方法的区别以及用法. escape 方法: 引用 MSDN JScript: The escape method returns a string value (in Unicode format) that contains the contents of [the argument]. All space…