模板字符串函数
const name = 'smu'
const gender = true
function myTag(arge,name,gender) {
return arge[0] + name + arge[1] + gender + arge[2]
}
const result = myTag`hey,${name} is a ${gender}.`
console.log(result);
全局函数
#函数可把字符串作为 URI 进行编码
encodeURI(uri)
#函数可对 encodeURI() 函数编码过的 URI 进行解码
decodeURI(uri)
#函数可把字符串作为 URI 组件进行编码
encodeURIComponent(uri)
#函数可对 encodeURIComponent() 函数编码的 URI 进行解码
decodeURIComponent(uri)
#函数可对字符串进行编码,这样就可以在所有的计算机上读取该字符串(对中文进行编码)
escape(string)
#函数可对通过 escape() 编码的字符串进行解码。
unescape(string)