All pastes #448432 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-19 17:11 UTC
rendered paste body
<html>
<head>
<script type="text/javascript">
myObject = new function(){
  this.myString = "outside scope of myMethod";
  this.myMethod = function(){
    myObject.myMethod.myString = "inside scope of myMethod";
    alert(this.myString);
  }
}

function anotherObject(){
  this.myString = "outside scope of anotherObject";
  this.myMethod = function(){
    try{
    anotherObject.myMethod.myString = "inside scope of myMethod";
    } catch (ex){
      alert(ex);
    }
    alert(this.myString);
  }
}

myObject.myMethod();
yetAnotherObject = new anotherObject();
yetAnotherObject.myMethod();

</script>
</head>
<body>
</body>
</html>