scope and this in js with the preformance-1
by jack zhao
HTML
<div id="result">代码输出结果:<br/></div>
JavaScript
var resultCon;
function MyObj() {
this.name = 'MyObj下的name<br/>';
this.doFunction = function() {
resultCon.innerHTML += this.name;
};
}
MyObj.prototype.name = 'prototype下的name<br/>';
window.onload = function() {
resultCon = document.getElementById('result');
var obj = new MyObj();
obj.doFunction();
};