SOURCE

console 命令行工具 X clear

                    
>
console
function Point() { 
    this.x = 20;
    this.getX = function() { return this.x; }
}
var a = new Point();
var f = a.getX;
alert(f());

/*
ES6

class Point {
  constructor() {
    this.x = 20;
  }
  getX() {
    return this.x;
  }
}

var a = new Point();
var f = a.getX;
alert(f());
*/
<p><b>Question:</b></p>
What will this code alert? Why?
<p><b>题目:</b></p>
按「Run」会出现什麽提示呢?为什麽呢?