{"ScriptPreparationCode":"var dataPool = [\u00221234\u0022, \u00221X34\u0022, \u00220123\u0022, \u002212x4\u0022];\r\nvar testStr = dataPool[Math.floor(Math.random() * dataPool.length)];","TestCases":[{"Name":"Regex","Code":"let isValid = true;\r\n\tlet regStr = \u0060(${i\u002B1}|X)\u0060;\r\n const regEx = new RegExp(regStr);\r\nfor (let i = 0; i \u003C testStr.length; i\u002B\u002B)\r\n{\r\n\tlet code = testStr.charAt(i);\r\n if(regEx.test(code) === false){\r\n isValid = false;\r\n\t\tbreak;\r\n }\r\n}\r\nreturn isValid;","IsDeferred":false},{"Name":"For loop, ParseInt","Code":"let isValid = true;\r\nfor (let i = 0; i \u003C testStr.length; i\u002B\u002B)\r\n{\r\n\tlet code = testStr.charAt(i);\r\n if (code === \u0022X\u0022){\r\n }\r\n else{\r\n let codeValue = parseInt(code, 10);\r\n if(codeValue !== i\u002B1){\r\n \tisValid = false;\r\n\t\tbreak;\r\n }\r\n }\r\n}\r\nreturn isValid;","IsDeferred":false},{"Name":"For loop with switch case","Code":"let isValid = true;\r\nfor (let i = 0; i \u003C testStr.length; i\u002B\u002B)\r\n{\t\t\r\n let char = testStr.charAt(i);\r\n\t\tswitch (true) {\r\n case char === \u0027X\u0027:\r\n break;\r\n case parseInt(char, 10) === i \u002B 1:\r\n break;\r\n default:\r\n isValid = false;\r\n }\r\n}\r\nreturn isValid;\r\n\r\n","IsDeferred":false},{"Name":"For loop, toString","Code":"let isValid = true;\r\nfor (let i = 0; i \u003C testStr.length; i\u002B\u002B)\r\n{\r\n\tlet code = testStr.charAt(i);\r\n if (code === \u0022X\u0022){\r\n }\r\n else{\r\n if(code !== (i\u002B1).toString()){\r\n \tisValid = false;\r\n\t\tbreak;\r\n }\r\n }\r\n}\r\nreturn isValid;","IsDeferred":false}]}