Acfe 发表于 2017-2-24 09:57:07

[JavaScript] Nodejs/Export和Import

class Point {  constructor(x, y) {
  this.x = x;
  this.y = y;
  }
  add (){
  this.x = this.x ? this.x : 1;
  this.y = this.y ? this.y : 2;
  return this.x + this.y;
  }
  }
  const PI = 3.1415926;
  exports.Point = Point;
  exports.PI = PI;
  let a = new Point();
  console.log(a.add());
页: [1]
查看完整版本: [JavaScript] Nodejs/Export和Import