转载自Qt官方手册:List of JavaScript Objects and Functions
JavaScript对象和函数参考手册
1. 全局对象 (The Global Object)
1.1 值属性 (Value Properties)
NaN
非数字值Infinity
无穷大undefined
未定义
1.2 函数属性 (Function Properties)
eval(x)
执行字符串代码parseInt(string, radix)
字符串转整数parseFloat(string)
字符串转浮点数isNaN(number)
检查是否为NaNisFinite(number)
检查是否为有限数decodeURI(encodedURI)
解码URIdecodeURIComponent(encodedURIComponent)
解码URI组件encodeURI(uri)
编码URIencodeURIComponent(uriComponent)
编码URI组件escape(string)
编码字符串unescape(string)
解码字符串
1.3 构造函数属性 (Constructor Properties)
Object
对象构造函数Function
函数构造函数Array
数组构造函数ArrayBuffer
数组缓冲区String
字符串构造函数Boolean
布尔值构造函数Number
数字构造函数DataView
数据视图Date
日期构造函数Promise
Promise对象RegExp
正则表达式Map
Map对象WeakMap
弱引用MapSet
Set对象WeakSet
弱引用SetSharedArrayBuffer
共享数组缓冲区Symbol
Symbol对象Error
错误对象EvalError
eval错误RangeError
范围错误ReferenceError
引用错误SyntaxError
语法错误TypeError
类型错误URIError
URI错误
1.4 其他属性 (Other Properties)
Atomics
原子操作Math
数学对象JSON
JSON对象Reflect
反射对象Proxy
代理对象
2. Object对象 (The Object Object)
2.1 Object构造函数 (Object Constructor)
函数属性 (Function Properties)
getPrototypeOf(O)
获取原型setPrototypeOf(O, P)
设置原型getOwnPropertyDescriptor(O, P)
获取属性描述符getOwnPropertyDescriptors(O)
获取所有属性描述符getOwnPropertyNames(O)
获取所有属性名getOwnPropertySymbols(O)
获取所有Symbol属性assign(O [, Properties])
合并对象create(O [, Properties])
创建对象defineProperty(O, P, Attributes)
定义属性defineProperties(O, Properties)
定义多个属性entries(O)
获取键值对数组is(V1, V2)
比较值是否相同keys(O)
获取可枚举属性名values(O)
获取可枚举属性值seal(O)
密封对象isSealed(O)
检查是否密封freeze(O)
冻结对象isFrozen(O)
检查是否冻结preventExtensions(O)
阻止扩展isExtensible(O)
检查是否可扩展
2.2 Object原型 (Object Prototype)
函数属性 (Function Properties)
toString()
转为字符串toLocaleString()
本地化字符串valueOf()
获取原始值hasOwnProperty(V)
检查是否自有属性isPrototypeOf(V)
检查是否在原型链上propertyIsEnumerable(V)
检查是否可枚举__defineGetter__(P, F)
定义getter__defineSetter__(P, F)
定义setter
3. 函数对象 (Function Objects)
3.1 函数原型 (Function Prototype)
函数属性 (Function Properties)
toString()
转为字符串apply(thisArg, argArray)
调用函数call(thisArg [, arg1 [, arg2, ...]])
调用函数bind((thisArg [, arg1 [, arg2, …]])
绑定this[Symbol.hasInstance](O)
instanceof操作符调用
4. 数组对象 (Array Objects)
4.1 数组原型对象 (Array Prototype Object)
函数属性 (Function Properties)
toString()
转为字符串toLocaleString()
本地化字符串concat([item1 [, item2 [, ...]]])
合并数组copyWithin([item1 [, item2 [, ...]]])
数组内复制entries()
返回键值对迭代器fill(item [, index1 [, index2]])
填充数组join(separator)
连接数组元素find(callbackfn [, thisArg])
查找元素findIndex(callbackfn [, thisArg])
查找元素索引includes(item)
检查是否包含keys()
返回键迭代器pop()
移除最后一个元素push([item1 [, item2 [, ...]]])
添加元素到末尾reverse()
反转数组shift()
移除第一个元素slice(start, end)
截取数组sort(comparefn)
排序数组splice(start, deleteCount[, item1 [, item2 [, ...]]])
修改数组unshift([item1 [, item2 [, ...]]])
添加元素到开头indexOf(searchElement [, fromIndex])
查找元素索引lastIndexOf(searchElement [, fromIndex])
从后查找元素索引every(callbackfn [, thisArg])
测试所有元素some(callbackfn [, thisArg])
测试某些元素forEach(callbackfn [, thisArg])
遍历数组map(callbackfn [, thisArg])
映射数组filter(callbackfn [, thisArg])
过滤数组reduce(callbackfn [, initialValue])
从左累加reduceRight(callbackfn [, initialValue])
从右累加values()
返回值迭代器[Symbol.iterator]()
返回迭代器
5. 字符串对象 (String Objects)
5.1 字符串原型对象 (String Prototype Object)
函数属性 (Function Properties)
toString()
转为字符串valueOf()
获取原始值charAt(pos)
获取指定位置字符charCodeAt(pos)
获取字符编码codePointAt(pos)
获取代码点concat([string1 [, string2 [, ...]]])
连接字符串endsWith(searchString [, endPosition ])
检查是否以某字符串结尾includes(searchString [, position ])
检查是否包含indexOf(searchString ,position)
查找字符串位置lastIndexOf(searchString, position)
从后查找字符串位置localeCompare(that)
本地化比较match(regexp)
匹配正则normalize()
Unicode标准化padEnd(length [, string])
尾部填充padStart(length [, string])
头部填充repeat(count)
重复字符串replace(searchValue, replaceValue)
替换字符串search(regexp)
搜索正则匹配slice(start, end)
截取字符串split(separator, limit)
分割字符串startsWith(searchString [, position ])
检查是否以某字符串开头substr(start, length)
截取子串substring(start, end)
截取子串toLowerCase()
转为小写toLocaleLowerCase()
本地化转为小写toUpperCase()
转为大写toLocaleUpperCase()
本地化转为大写trim()
去除两端空白[Symbol.iterator]()
返回迭代器
QML引擎添加的函数
string::arg()
格式化字符串
6. 布尔对象 (Boolean Objects)
6.1 布尔原型对象 (Boolean Prototype Object)
函数属性 (Function Properties)
toString()
转为字符串valueOf()
获取原始值
7. 数字对象 (Number Objects)
7.1 数字原型对象 (Number Prototype Object)
函数属性 (Function Properties)
toString(radix)
转为指定进制字符串toLocaleString()
本地化字符串valueOf()
获取原始值toFixed(fractionDigits)
转为固定小数位字符串toExponential(fractionDigits)
转为指数形式toPrecision(precision)
转为指定精度字符串
QML引擎添加的函数
fromLocaleString(locale, number)
从本地化字符串解析toLocaleCurrencyString(locale, symbol)
转为本地化货币字符串toLocaleString(locale, format, precision)
转为本地化字符串
7.2 Number对象 (The Number Object)
值属性 (Value Properties)
NaN
非数字值NEGATIVE_INFINITY
负无穷POSITIVE_INFINITY
正无穷MAX_VALUE
最大数值MIN_VALUE
最小数值EPSILON
极小常量MAX_SAFE_INTEGER
最大安全整数MIN_SAFE_INTEGER
最小安全整数
函数属性 (Function Properties)
isFinite(x)
检查是否有限isInteger(x)
检查是否为整数isSafeInteger(x)
检查是否为安全整数isNaN(x)
检查是否为NaN
8. 数学对象 (The Math Object)
8.1 值属性 (Value Properties)
E
自然对数底LN10
10的自然对数LN2
2的自然对数LOG2E
以2为底E的对数LOG10E
以10为底E的对数PI
圆周率SQRT1_2
1/2的平方根SQRT2
2的平方根
8.2 函数属性 (Function Properties)
abs(x)
绝对值acos(x)
反余弦acosh(x)
反双曲余弦asin(x)
反正弦asinh(x)
反双曲正弦atan(x)
反正切atanh(x)
反双曲正切atan2(y, x)
两点间角度cbrt(x)
立方根ceil(x)
向上取整clz32(x)
前导零位数cos(x)
余弦cosh(x)
双曲余弦exp(x)
e的x次方expm1(x)
e^x-1floor(x)
向下取整fround(x)
最近单精度浮点hypot(x, y)
平方和的平方根imul(x, y)
32位整数乘法log(x)
自然对数log10(x)
以10为底对数log1p(x)
1+x的自然对数log2(x)
以2为底对数max([value1 [, value2 [, ...]]])
最大值min([value1 [, value2 [, ...]]])
最小值pow(x, y)
x的y次方random()
随机数round(x)
四舍五入sign(x)
符号函数sin(x)
正弦sinh(x)
双曲正弦sqrt(x)
平方根tan(x)
正切tanh(x)
双曲正切trunc(x)
去除小数部分
9. 日期对象 (Date Objects)
9.1 日期原型对象 (Date Prototype Object)
函数属性 (Function Properties)
toString()
转为字符串toDateString()
返回日期部分字符串toTimeString()
返回时间部分字符串toLocaleString()
本地化字符串toLocaleDateString()
本地化日期字符串toLocaleTimeString()
本地化时间字符串valueOf()
获取原始值getTime()
获取时间戳getFullYear()
获取年份getUTCFullYear()
获取UTC年份getMonth()
获取月份getUTCMonth()
获取UTC月份getDate()
获取日期getUTCDate()
获取UTC日期getDay()
获取星期getUTCDay()
获取UTC星期getHours()
获取小时getUTCHours()
获取UTC小时getMinutes()
获取分钟getUTCMinutes()
获取UTC分钟getSeconds()
获取秒数getUTCSeconds()
获取UTC秒数getMilliseconds()
获取毫秒getUTCMilliseconds()
获取UTC毫秒getTimeZoneOffset()
获取时区偏移setTime(time)
设置时间戳setMilliseconds(ms)
设置毫秒setUTCMilliseconds(ms)
设置UTC毫秒setSeconds(sec [, ms])
设置秒setUTCSeconds(sec [, ms])
设置UTC秒setMinutes(min [, sec [, ms]])
设置分钟setUTCMinutes(min [, sec [, ms]])
设置UTC分钟setHours(hour [, min [, sec [, ms]]])
设置小时setUTCHours(hour [, min [, sec [, ms]]])
设置UTC小时setDate(date)
设置日期setUTCDate(date)
设置UTC日期setMonth(month [, date])
设置月份setUTCMonth(month [, date])
设置UTC月份setYear(year)
设置年份setFullYear(year [, month [, date]])
设置完整年份setUTCFullYear(year [, month [, date]])
设置UTC完整年份toUTCString()
转为UTC字符串toGMTString()
转为GMT字符串toISOString()
转为ISO格式字符串toJSON()
转为JSON字符串[Symbol.toPrimitive](hint)
原始值转换
QML引擎添加的函数
timeZoneUpdated()
时区更新toLocaleDateString(locale, format)
本地化日期字符串toLocaleString(locale, format)
本地化字符串toLocaleTimeString(locale, format)
本地化时间字符串
10. 正则表达式对象 (RegExp Objects)
10.1 正则表达式原型对象 (RegExp Prototype Object)
函数属性 (Function Properties)
exec(string)
执行匹配test(string)
测试匹配toString()
转为字符串
11. 错误对象 (Error Objects)
11.1 错误原型对象 (Error Prototype Object)
值属性 (Value Properties)
name
错误名称message
错误消息
函数属性 (Function Properties)
toString()
转为字符串
12. JSON对象 (The JSON Object)
函数属性 (Function Properties)
parse(text [, reviver])
解析JSON字符串stringify(value [, replacer [, space]])
转为JSON字符串