Since Javascript 1.7 there is an Iterator object, which allows this:
var a={a:1,b:2,c:3};
var it=Iterator(a);
function iterate(){
try {
consol
Also remember that you can pass a second argument to the .forEach() function specifying the object to use as the this keyword.
// myOjbect is the object you want to iterate.
// Notice the second argument (secondArg) we passed to .forEach.
Object.keys(myObject).forEach(function(element, key, _array) {
// element is the name of the key.
// key is just a numerical value for the array
// _array is the array of all the keys
// this keyword = secondArg
this.foo;
this.bar();
}, secondArg);