三端的脚本执行环境以及用于渲染非原生组件的环境是各不相同的:

    • 在 iOS 上,小程序的 javascript 代码是运行在 JavaScriptCore 中,是由 WKWebView 来渲染的,环境有 iOS8、iOS9、iOS10
    • ES6 语法支持不一致语法上开发者可以通过开启 ES6 转 ES5 的功能来规避。

    微信小程序已经支持了绝大部分的 ES6 API,具体表格如下:

    • tip: TBS 3.0 是指微信小程序 Android 运行环境
    • tip: Array.values 不支持
    Array iOS8 iOS9 iOS10 TBS3.0
    copyWithin
    find
    findIndex
    fill
    entries
    keys
    values
    includes
    Array.from
    Array.of
    Math iOS8 iOS9 iOS10 TBS3.0
    trunc
    sign
    cbrt
    clz32
    imul
    fround
    hypot
    expm1
    log1p
    log10
    log2
    sinh
    cosh
    tanh
    asinh
    acosh
    atanh
    Other iOS8 iOS9 iOS10 TBS3.0
    Symbol
    Set
    Map
    Proxy
    Reflect
    Promise