Skip to content

值属性

这些全局属性返回一个简单值,这些值没有自己的属性和方法。

全局属性说明示例
Infinity数值,表示无穷大console.log(Infinity + 1 ); Infinity
console.log(Infinity+555===Infinity) true
NaN
undefined
globalThis

函数属性

全局函数可以直接调用,不需要在调用时指定所属对象,执行结束后会将结果直接返回给调用者

全局属性说明参数返回值示例
encodeURIComponent()编码URLuriComponent:一个 string、number、boolean、null,undefined 或者任何 object。在编码之前,uriComponent 参数会被转化为字符串原字串作为 URI 组成部分被被编码后的新字符串encodeURIComponent(uriComponent);
decodeURIComponent()解码URL,将已编码 URI 中所有能识别的转义序列转换成原字符。encodedURI:编码后的部分 URI一个解码后的统一资源标识符(URI)字符串,处理前的 URI 经过了给定格式的编码。decodeURIComponent(encodedURI)