//原理要點,Function也是一個對象
$(function () {
var Person = function (name) {
this.name = name;
this.say = function () {
return 'name is '+ this.name;
}
};
var p = new Person('李四');
var s = p.say();
console.log(s);
var p2 = new Person('王五');
var s2 = p2.say();
console.log(s2);
});
可以完成不同參數輸出不同值。