{"ScriptPreparationCode":null,"TestCases":[{"Name":"for of loop","Code":"function findJewels (jewels, stones) {\r\n // iterate through our stones.. if it is a jewel, increment\r\n let count = 0;\r\n for (const char of stones) {\r\n if (jewels.includes(char)) count\u002B\u002B;\r\n }\r\n return count;\r\n};\r\nfor (i = 0; i \u003C 10; i\u002B\u002B) {\r\n console.log(findJewels(\u0022aA\u0022, \u0022aAAbbbb\u0022), \u00223\u0022);\r\n console.log(findJewels(\u0022z\u0022, \u0022ZZ\u0022), \u00220\u0022);\r\n}","IsDeferred":false},{"Name":"hashmap","Code":"function findJewels(jewels, stones) {\r\n const map = {};\r\n let count = 0;\r\n\r\n for (const jewel of jewels) {\r\n map[jewel] = true;\r\n }\r\n for (const stone of stones) {\r\n if (map[stone]) {\r\n count\u002B\u002B;\r\n }\r\n }\r\n return count;\r\n}\r\nfor (i = 0; i \u003C 10; i\u002B\u002B) {\r\n console.log(findJewels(\u0022aA\u0022, \u0022aAAbbbb\u0022), \u00223\u0022);\r\n console.log(findJewels(\u0022z\u0022, \u0022ZZ\u0022), \u00220\u0022);\r\n}","IsDeferred":false},{"Name":"for loop","Code":"function findJewels(jewels, stones) {\r\n // declare a count \u0026 length variable\r\n\r\n let count = 0;\r\n let len = stones.length;\r\n\r\n // Iterate through the longest array stones. Increment count by 1 if it exists in jewels\r\n\r\n for (let i = 0; i \u003C len; i\u002B\u002B) {\r\n if (jewels.indexOf(stones[i]) \u003E= 0) {\r\n count\u002B\u002B;\r\n }\r\n }\r\n return count;\r\n}","IsDeferred":false}]}