ES6形参默认值

   * 形参的默认值----当不传入参数的时候默认使用形参里的默认值

   function Point(x = 1,y = 2) {
    this.x = x;
    this.y = y;
    }
 //定义一个点的坐标
    function Point(x=12, y=12) {
        this.x = x;
        this.y = y;
    }
    let point = new Point(25, 36);
    console.log(point);
    let p = new Point();
    console.log(p);
    let point1 = new Point(12, 35);
    console.log(point1);
原文地址:https://www.cnblogs.com/hack-ing/p/12009346.html