小程序JavaScript 支持情况

作者: wechat 发布时间: 2019-11-09 浏览: 1638 次 编辑

小程序JavaScript 支持情况

运行限制

基于安全考虑,小程序中不支持动态执行 JS 代码,即:

  • 不支持使用 eval 执行 JS 代码
  • 不支持使用 new Function 创建函数

客户端 ES6 API 支持情况

微信小程序已经支持了绝大部分的 ES6 API,已支持的 API 如下(部分API依赖系统版本):

StringiOS8iOS9iOS10Android
codePointAt
normalize
includes
startsWith
endsWith
repeat
String.fromCodePoint
ArrayiOS8iOS9iOS10Android
copyWithin
find
findIndex
fill
entries
keys
values
includes
Array.from
Array.of
NumberiOS8iOS9iOS10Android
isFinite
isNaN
parseInt
parseFloat
isInteger
EPSILON
isSafeInteger
MathiOS8iOS9iOS10Android
trunc
sign
cbrt
clz32
imul
fround
hypot
expm1
log1p
log10
log2
sinh
cosh
tanh
asinh
acosh
atanh
ObjectiOS8iOS9iOS10Android
is
assign
getOwnPropertyDescriptor
keys
getOwnPropertyNames
getOwnPropertySymbols
OtheriOS8iOS9iOS10Android
Symbol
Set
Map
Proxy
Reflect
Promise