{"ScriptPreparationCode":"var item = 45;\r\n\r\n var data = [\r\n // { range: [1,2,3,4,5,6,7,8,9], value: \u0022less than 10\u0022 },\r\n { range: [10, 11,12,13,14,15,16,17,18,19], value: \u0022less than 20\u0022 },\r\n { range: [20, 21,22,23,24,25,26,27,28,29], value: \u0022less than 30\u0022 },\r\n { range: [30, 31,32,33,34,35,36,37,38,39], value: \u0022less than 40\u0022 },\r\n { range: [40, 41,42,43,44,45,46,47,48,49, 25], value: \u0022less than 50\u0022 },\r\n ];\r\n\r\nconst amatch = () =\u003E {\r\n // Exclusions - borders - out-of-bound\r\n if (item \u003C 10) return \u0022less than 10\u0022;\r\n if (item \u003E= 50) return \u002250 or more!\u0022;\r\n // within range\r\n // return (data.filter(record =\u003E record.range.includes(item)))[0].value \r\n // Below is BETTER that above as it stops on first finding!!!!\r\n return (data.find(record =\u003E record.range.includes(item))).value \r\n };","TestCases":[{"Name":"if-else","Code":"if (item \u003C 10) {\r\n console.log(\u0022less than 10\u0022);\r\n } else if (item \u003C 20) {\r\n console.log(\u0022less than 20\u0022);\r\n } else if (item \u003C 30) {\r\n console.log(\u0022less than 30\u0022);\r\n } else if (item \u003C 40) {\r\n console.log(\u0022less than 40\u0022);\r\n } else if (item \u003C 50) {\r\n console.log(\u0022less than 50\u0022);\r\n } else {\r\n console.log(\u002250 or more!\u0022);\r\n }","IsDeferred":false},{"Name":"switch","Code":" switch (item) {\r\n case (item \u003C 10):\r\n console.log(\u0022less than 10\u0022);\r\n break;\r\n case (item \u003C 20):\r\n console.log(\u0022less than 20\u0022);\r\n break;\r\n case (item \u003C 30):\r\n console.log(\u0022less than 30\u0022);\r\n break;\r\n case (item \u003C 40):\r\n console.log(\u0022less than 40\u0022);\r\n break;\r\n case (item \u003C 50):\r\n console.log(\u0022less than 50\u0022);\r\n break;\r\n default:\r\n console.log(\u002250 or more!\u0022);\r\n }","IsDeferred":false},{"Name":"amatch","Code":"const amatch = () =\u003E {\r\n // Exclusions - borders - out-of-bound\r\n if (item \u003C 10) return \u0022less than 10\u0022;\r\n if (item \u003E= 50) return \u002250 or more!\u0022;\r\n // within range\r\n // return (data.filter(record =\u003E record.range.includes(item)))[0].value \r\n // Below is BETTER that above as it stops on first finding!!!!\r\n return (data.find(record =\u003E record.range.includes(item))).value \r\n };\r\n\r\namatch(item);","IsDeferred":false}]}