1.----------------------------------------------------
var fun = function(){ this.name = 'peter'; return { name: 'jack' }; } var p = new fun();
請問p.name是:
a:'peter', b:'jack', c:null, d:undefined
2.----------------------------------------------------
var fun = function(){ this.name = 'peter'; return 'jack'; } var p = new fun();
請問p.name是:
a:'peter', b:'jack', c:null, d:undefined
3.----------------------------------------------------
var fun = function(){ } fun.prototype = { info : { name : 'peter', age : 25 } } var a = new fun(); var b = new fun(); a.info.name = 'jack'; b.info.name = 'tom';
請問a.info.name和b.info.name分別是:
a:'jack', 'tom', b:'jack', 'jack', c:'tom','tom', d:'tom', 'jack'
4.----------------------------------------------------
var fun = function(){ this.info = { name : 'peter', age : 25 } } var a = new fun(); var b = new fun(); a.info.name = 'jack'; b.info.name = 'tom';
請問a.info.name和b.info.name分別是:
a:'jack', 'tom', b:'jack', 'jack', c:'tom','tom', d:'tom', 'jack', e:其它
5.----------------------------------------------------
var fun = function(){ } fun.prototype = { name : 'peter', age : 25 } var a = new fun(); var b = new fun(); a.name = 'jack'; b.name = 'tom';
請問a.name和b.name分別是:
a:'jack', 'tom', b:'jack', 'jack', c:'tom','tom', d:'tom', 'jack', e:其它
6.----------------------------------------------------
var fun = function(){ this.info = { name : 'peter', age : 25 } } fun.prototype = { info : { name : 'peter', age : 25 } } var a = new fun(); var b = new fun(); a.info.name = 'jack'; b.info.name = 'tom';
請問a.info.name和b.info.name分別是:
a:'jack', 'tom', b:'jack', 'jack', c:'tom','tom', d:'tom', 'jack'