Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat Program Basic Class Library


May 18, 2021 WeChat Mini Program Development Document


Table of contents


console

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

Math

Property

  • E
  • LN10
  • LN2
  • LOG2E
  • LOG10E
  • Pi
  • SQRT1_2
  • SQRT2
Please refer to the ES5 standard for the specific use of the above properties.

Method

  • Abs
  • acos
  • asin
  • atan
  • atan2
  • ceil
  • cos
  • Exp
  • floor
  • log
  • max
  • min
  • pow
  • random
  • round
  • sin
  • sqrt
  • tan
Please refer to the ES5 standard for the specific use of the above methods.

Json

Method

  • stringify(object): Converts the object object to a JSON string and returns the string.
  • parse(string): Transforms the JSON string into an object and returns it.

Example code:


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(){})));

Number

Property

  • MAX_VALUE
  • MIN_VALUE
  • NEGATIVE_INFINITY
  • POSITIVE_INFINITY
Please refer to the ES5 standard for the specific use of the above properties.

Date

Property

  • parse
  • Utc
  • now
Please refer to the ES5 standard for the specific use of the above properties.

Global

Property

  • NaN
  • Infinity
  • undefined
Please refer to the ES5 standard for the specific use of the above properties.

Method

  • parseInt
  • parseFloat
  • isNaN
  • isFinite
  • decodeURI
  • decodeURIComponent
  • encodeURI
  • encodeURIComponent
Please refer to the ES5 standard for the specific use of the above methods.