跳到主要内容

数据类型

原始类型 (Primitive Values)

值一经定义无法修改

Object

  • key type: String or Symbol
  • Object type: Number, String, Boolean, Symbol
new Number(3)
  • Change prototype of object type will apply to primitive type
Symbol.prototype.hello = () => console.log("hello")
var a = Symbol("a");
a.hello(); // hello

Type Conversion

StringToNumber

  • StringToNumber supports: DEC, BIN, OCT, HEX, scientific notation
  • Normally using Number is better than parseInt and parseFloat

NumberToString

  • Extreme large or small value will use scientific notation