文档

基础类库

更新时间:

Global

说明:SJS 不支持 JavaScript 的大部分全局属性和方法。

属性

  • Infinity
  • NaN
  • undefined
说明:具体使用参考 ES5 标准。

方法

  • decodeURI
  • decodeURIComponent
  • encodeURI
  • encodeURIComponent
  • isNaN
  • isFinite
  • parseFloat
  • parseInt
说明:具体使用参考 ES5 标准。

console

console.log 方法可在 console 窗口输出信息,可以接受多个参数,将多个参数结果连接起来输出。

Date

方法

  • now
  • parse
  • UTC
说明:具体使用参考 ES5 标准。

Number

属性

  • MAX_VALUE
  • MIN_VALUE
  • NEGATIVE_INFINITY
  • POSITIVE_INFINITY
说明:具体使用参考 ES5 标准。

JSON

方法

  • stringify(object): 将 object 对象转换为 JSON 字符串,并返回该字符串。
  • parse(string): 将 JSON 字符串转化成对象,并返回该对象。

示例

  1. console.log(undefined === JSON.stringify());
  2. console.log(undefined === JSON.stringify(undefined));
  3. console.log("null"===JSON.stringify(null));
  4. console.log("222"===JSON.stringify(222));
  5. console.log('"222"'===JSON.stringify("222"));
  6. console.log("true"===JSON.stringify(true));
  7. console.log(undefined===JSON.stringify(function(){}));
  8. console.log(undefined===JSON.parse(JSON.stringify()));
  9. console.log(undefined===JSON.parse(JSON.stringify(undefined)));
  10. console.log(null===JSON.parse(JSON.stringify(null)));
  11. console.log(222===JSON.parse(JSON.stringify(222)));
  12. console.log("222"===JSON.parse(JSON.stringify("222")));
  13. console.log(true===JSON.parse(JSON.stringify(true)));
  14. console.log(undefined===JSON.parse(JSON.stringify(function(){})));

Math

属性

  • E
  • LN10
  • LN2
  • LOG2E
  • LOG10E
  • PI
  • SQRT1_2
  • SQRT2
说明:具体使用参考 ES5 标准。

方法

  • abs
  • acos
  • asin
  • atan
  • atan2
  • ceil
  • cos
  • exp
  • floor
  • log
  • max
  • min
  • pow
  • random
  • round
  • sin
  • sqrt
  • tan
说明:具体使用参考 ES5 标准。
  • 本页导读 (0)
文档反馈