Basic Library

Global

Note: SJS does not support most global attributes and methods of JavaScript.

Attribute

  • Infinity
  • NaN
  • undefined

For specific usage, see the ES5 standard.

Method

  • decodeURI
  • decodeURIComponent
  • encodeURI
  • encodeURIComponent
  • isNaN
  • isFinite
  • parseFloat
  • parseInt

For specific usage, see the ES5 standard.

Console

The console.log method can output information in the console window and accept multiple parameters and combine their results for output.

Date

Method

  • now
  • parse
  • UTC

For specific usage, see the ES5 standard.

Number

Attribute

  • MAX_VALUE
  • MIN_VALUE
  • NEGATIVE_INFINITY
  • POSITIVE_INFINITY

For specific usage, see the ES5 standard.

JSON

Method

  • stringify(object): Convert the object into a JSON string and return the string
  • parse(string): Convert the JSON string into an object and return the object

Example

copy
console.log(undefined === JSON.stringify());
console.log(undefined === JSON.stringify(undefined));
console.log("null"===JSON.stringify(null));
console.log("222"===JSON.stringify(222));
console.log('"222"'===JSON.stringify("222"));
console.log("true"===JSON.stringify(true));
console.log(undefined===JSON.stringify(function(){}));
console.log(undefined===JSON.parse(JSON.stringify()));
console.log(undefined===JSON.parse(JSON.stringify(undefined)));
console.log(null===JSON.parse(JSON.stringify(null)));
console.log(222===JSON.parse(JSON.stringify(222)));
console.log("222"===JSON.parse(JSON.stringify("222")));
console.log(true===JSON.parse(JSON.stringify(true)));
console.log(undefined===JSON.parse(JSON.stringify(function(){})));

Math

Attribute

  • E
  • LN10
  • LN2
  • LOG2E
  • LOG10E
  • PI
  • SQRT1_2
  • SQRT2

For specific usage, see the ES5 standard.

Method

  • abs
  • acos
  • asin
  • atan
  • atan2
  • ceil
  • cos
  • exp
  • floor
  • log
  • max
  • min
  • pow
  • random
  • round
  • sin
  • sqrt
  • tan

For specific usage, see the ES5 standard.