{"ScriptPreparationCode":null,"TestCases":[{"Name":"forEach version","Code":"// useful for HtmlCollection, NodeList, String types\r\nfunction forEach(array, callback, scope){for (var i=0,n=array.length; i\u003Cn; i\u002B\u002B)callback.call(scope, array[i], i, array);} // passes back stuff we need\r\n\r\nfunction countVowels(input)\r\n{\r\n\tvar vowels = \u0027aeiou\u0027, result = 0;\r\n\tforEach( input, function(char){ if (vowels.indexOf(char) != -1) result\u002B\u002B; } );\r\n\treturn result;\r\n}\r\ncountVowels(\u0022goes\u0022);","IsDeferred":false},{"Name":"regexVersion","Code":"function VowelCount(str) { \r\n var pattern = /[aeiou]/i;\r\n var vowelCount = 0;\r\n\r\n for (var i = 0; i \u003C str.length; i\u002B\u002B) {\r\n if (pattern.test(str[i])){\r\n vowelCount\u002B\u002B;\r\n }\r\n }\r\n return vowelCount; \r\n}\r\n\r\nVowelCount(\u0022goes\u0022)","IsDeferred":false}]}