All Products
Search
Document Center

Basic library

Last Updated: Feb 04, 2021

Global

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

Attribute

  • Infinity
  • NaN
  • undefined
Note: For information about how to use these global attributes, see the ES5 specification.

Method

  • decodeURI
  • decodeURIComponent
  • encodeURI
  • encodeURIComponent
  • isNaN
  • isFinite
  • parseFloat
  • parseInt
Note: For information about how to use these global attributes, see the ES5 specification.

console

The console.log method is used to output relevant information in the console. This method can accept multiple parameters and connect the parameter results in the output.

Date

Method

  • now
  • parse
  • UTC
Note: For information about how to use these global attributes, see the ES5 specification.

Number

Attribute

  • MAX_VALUE
  • MIN_VALUE
  • NEGATIVE_INFINITY
  • POSITIVE_INFINITY
Note: For information about how to use these global attributes, see the ES5 specification.

JSON

Method

  • stringify(object): converts an object into a JSON string and returns the string.
  • parse(string): converts a JSON string into an object and returns the object.

Example

 
  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

Attribute

  • E
  • LN10
  • LN2
  • LOG2E
  • LOG10E
  • PI
  • SQRT1_2
  • SQRT2
Note: For information about how to use these global attributes, see the ES5 specification.

Method

  • abs
  • acos
  • asin
  • atan
  • atan2
  • ceil
  • cos
  • exp
  • floor
  • log
  • max
  • min
  • pow
  • random
  • round
  • sin
  • sqrt
  • tan
Note: For information about how to use these global attributes, see the ES5 specification.