{"ScriptPreparationCode":"var i = 0, MAX_SIZE = 10, a;\r\nvar loop = 100\r\nvar map = new Map();\r\n\r\nfor (i = 0; i \u003C MAX_SIZE; i\u002B\u002B) {\r\n map.set(i, i * i);\r\n}\r\n\r\n","TestCases":[{"Name":"Clean 1 by 1","Code":"/*When writing async/deferred tests, use \u0060deferred.resolve()\u0060 to mark test as done*/\r\n\r\nfor (i = 0; i \u003C loop; i\u002B\u002B) {\r\n map.set(i, i * i);\r\n if (map.size \u003E= MAX_SIZE) {\r\n let count = MAX_SIZE / 2;\r\n for (const key of map.keys()) {\r\n map.delete(key);\r\n\r\n count--;\r\n if (count \u003C= 0) {\r\n break;\r\n }\r\n }\r\n }\r\n}","IsDeferred":false},{"Name":"Clean by half","Code":"/*When writing async/deferred tests, use \u0060deferred.resolve()\u0060 to mark test as done*/\r\n\r\nfor (i = 0; i \u003C loop; i\u002B\u002B) {\r\n map.set(i, i * i);\r\n if (map.size \u003E= MAX_SIZE) {\r\n const itValue = map.keys()\r\n if(!itValue.done) {\r\n \tmap.delete(itValue.value)\r\n }\r\n }\r\n}","IsDeferred":false}]}