Is it possible to implement the "iterate" function (below) that iterates it's own variables that's not using deprecated JavaScript functionality?
(function () {
var a = 1;
var b = 2;
var iterate = function () {
var k;
for (k in this) { //WRONG IMPLEMENTATION!
alert(this[k]);
// a
// b
// iterate
}
};
}).call(this);
I set a breakpoint inside "iterate" and poked around in the debugger and was not able to figure out how to access the other variable names. Also, after perhaps dozens of Google searches I've not been able to find an answer as the search hits usually refer to an external not internal perspective.
UPDATE: I got properties and variables confused. Before editing, the original question was asking about iterating the properties. I now realize those are variables.