A
a.riser
Hello
When using *this* in an Array#each or Hash#each-loop this references
*window*. Is this intentional (I can't believe it)? An example here:
http://www.banza.net/jstest/this.html .
The code there is:
var Test = Class.create({
initialize: function(){
this.location = '----------- eeehhhh ---------------';
this.array = $A([1])
this.hasch = $H({key_one:'val_one'});
},
procede: function(){
document.writeln(' this.location: "'+this.location+'"<br />');
this.array.each( function( item ){
document.writeln(' this.location: "'+this.location+'"<br />');
});
document.writeln(' this.location: "'+this.location+'"<br />');
this.hasch.each( function( item ){
document.writeln(' this.location: "'+this.location+'"<br />');
});
}
});
x = new Test();
x.procede();
I'm using of course Prototype 1.6.0.2.
Greets, a.
When using *this* in an Array#each or Hash#each-loop this references
*window*. Is this intentional (I can't believe it)? An example here:
http://www.banza.net/jstest/this.html .
The code there is:
var Test = Class.create({
initialize: function(){
this.location = '----------- eeehhhh ---------------';
this.array = $A([1])
this.hasch = $H({key_one:'val_one'});
},
procede: function(){
document.writeln(' this.location: "'+this.location+'"<br />');
this.array.each( function( item ){
document.writeln(' this.location: "'+this.location+'"<br />');
});
document.writeln(' this.location: "'+this.location+'"<br />');
this.hasch.each( function( item ){
document.writeln(' this.location: "'+this.location+'"<br />');
});
}
});
x = new Test();
x.procede();
I'm using of course Prototype 1.6.0.2.
Greets, a.