Created
December 21, 2012 15:22
-
-
Save wolframkriesing/4353437 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dict = new Dictionary; | |
dict[runTests] = true; | |
var isFirstRun = true; | |
for (var key in dict) { | |
trace('key = ' + key); | |
if (isFirstRun) { | |
dict[this] = true; | |
isFirstRun = false; | |
} | |
delete dict[key]; | |
} | |
trace("dict[this] = " + dict[this]); | |
trace("dict[runTests] = " + dict[runTests]); | |
trace('======'); | |
var dict = new Dictionary; | |
dict[this] = true; | |
var isFirstRun = true; | |
for (var key in dict) { | |
trace('key = ' + key); | |
if (isFirstRun) { | |
dict[runTests] = true; | |
isFirstRun = false; | |
} | |
delete dict[key]; | |
} | |
trace("dict[this] = " + dict[this]); | |
trace("dict[runTests] = " + dict[runTests]); | |
/* outputs | |
key = function Function() {} | |
dict[this] = true | |
dict[runTests] = undefined | |
====== | |
key = [object DictionaryTests] | |
key = function Function() {} | |
dict[this] = undefined | |
dict[runTests] = undefined | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment