Y
yawnmoth
Say I have the following code snippet:
<script>
function a() {
this.b = 'test';
function c() {
return this.b;
}
//this.c = function() {
// return this.b;
//}
}
var d = new a();
alert(d.c());
</script>
Based on <http://www.sitepoint.com/article/oriented-programming-1/3>,
it seems like the uncommented code should work, yet as is, the only
code that does is the uncommented out code. Any idea as to why?
<script>
function a() {
this.b = 'test';
function c() {
return this.b;
}
//this.c = function() {
// return this.b;
//}
}
var d = new a();
alert(d.c());
</script>
Based on <http://www.sitepoint.com/article/oriented-programming-1/3>,
it seems like the uncommented code should work, yet as is, the only
code that does is the uncommented out code. Any idea as to why?