Skip to content

Basic Class Library

1. console

The console.log method is used to output information in the console window. It can accept multiple parameters and connect their results to output.

2. Math

Properties

  • E
  • LN10
  • LN2
  • LOG2E
  • LOG10E
  • PI
  • SQRT1_2
  • SQRT2
For the specific use of the above properties, please refer to the ES5 standard.

Method

  • abs
  • acos
  • asin
  • atan
  • atan2
  • ceil
  • cos
  • exp
  • floor
  • log
  • max
  • min
  • pow
  • random
  • round
  • sin
  • sqrt
  • tan
For the specific use of the above properties, please refer to the ES5 standard.

3. JSON

Method

  • stringify(object): Convert the object object to a JSON string and return the string.

  • parse(string): Convert the JSON string to an object and return the object.

Sample code:

js
console.log(undefined === JSON.stringify());
console.log(undefined === JSON.stringify(undefined));
console.log("null"===JSON.stringify(null));

console.log("111"===JSON.stringify(111));
console.log('"111"'===JSON.stringify("111"));
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(111===JSON.parse(JSON.stringify(111)));
console.log("111"===JSON.parse(JSON.stringify("111")));
console.log(true===JSON.parse(JSON.stringify(true)));

console.log(undefined===JSON.parse(JSON.stringify(function(){})));

4. Number

Properties

  • MAX_VALUE
  • MIN_VALUE
  • NEGATIVE_INFINITY
  • POSITIVE_INFINITY
For the specific use of the above properties, please refer to the ES5 standard.

5. Date

Properties

  • parse
  • UTC
  • now
For the specific use of the above properties, please refer to the ES5 standard.

6. Global

Properties

  • NaN
  • Infinity
  • undefined
For the specific use of the above properties, please refer to the ES5 standard.

Method

  • parseInt
  • parseFloat
  • isNaN
  • isFinite
  • decodeURI
  • decodeURIComponent
  • encodeURI
  • encodeURIComponent
For the specific use of the above properties, please refer to the ES5 standard.