{"ScriptPreparationCode":"var arr = [\u0027apple\u0027, \u0027banana\u0027, \u0027cherry\u0027, \u0027donuts\u0027, \u0027eggplant\u0027, \u0027french fries\u0027, \u0027goulash\u0027, \u0027hamburger\u0027, \u0027ice cream\u0027, \u0027juice\u0027, \u0027kebab\u0027, \u0027lemonade\u0027, \u0027mango\u0027, \u0027nuts\u0027, \u0027octopus\u0027, \u0027parsley\u0027, \u0027quail egg\u0027, \u0027risotto\u0027, \u0027stew\u0027, \u0027tapas\u0027, \u0027udon\u0027, \u0027vanilla\u0027, \u0027wheat\u0027, \u0027xylotil\u0027, \u0027yogurt\u0027, \u0027zucchinni\u0027];\r\n\r\nfunction forLoop(array, item) {\r\n\tfor (var i = 0; i \u003C array.length; i\u002B\u002B) {\r\n \tif (array[i] === item) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}\r\n\r\nfunction whileLoop(array, item) {\r\n \tvar i = 0;\r\n\twhile (i \u003C array.length) {\r\n \tif (array[i] === item) {\r\n \treturn i;\r\n }\r\n \ti \u002B= 1;\r\n }\r\n return -1;\r\n}\r\n\r\nfunction indexOfNative(array, item) {\r\n\treturn array.indexOf(item);\r\n}","TestCases":[{"Name":"For Loop for item towards beginning","Code":"forLoop(arr, \u0027donuts\u0027)","IsDeferred":false},{"Name":"While Loop for item towards beginning","Code":"whileLoop(arr, \u0027donuts\u0027)","IsDeferred":false},{"Name":"indexOf for item towards beginning","Code":"indexOfNative(arr, \u0027donuts\u0027)","IsDeferred":false},{"Name":"For Loop for item towards end","Code":"forLoop(arr, \u0027yogurt\u0027)","IsDeferred":false},{"Name":"While Loop for item towards end","Code":"whileLoop(arr, \u0027yogurt\u0027)","IsDeferred":false},{"Name":"indexOf for item towards end","Code":"indexOfNative(arr, \u0027yogurt\u0027)","IsDeferred":false}]}