{"ScriptPreparationCode":null,"TestCases":[{"Name":"Reverse array comparison (short)","Code":"const strings = [\u0027pop\u0027, \u0027noon\u0027, \u0027madam\u0027, \u0027james\u0027]\r\n\r\nconst checkPalendrome = string =\u003E {\r\n string === [...string].reverse().join(\u0027\u0027)\r\n}\r\n\r\nfor (const string of strings) {\r\n console.log(\u0060${string} palendrome = ${checkPalendrome(string)}\u0060)\r\n}","IsDeferred":false},{"Name":"For loop early exit (short)","Code":"const strings = [\u0027pop\u0027, \u0027noon\u0027, \u0027madam\u0027, \u0027james\u0027]\r\n\r\nconst checkPalendrome = string =\u003E {\r\n const length = string.length\r\n let isPalendrome = true\r\n\r\n for (let index = 0; index \u003C= length; index\u002B\u002B) {\r\n const left = string.charAt(index)\r\n const right = string.charAt(length - index - 1)\r\n\r\n isPalendrome = left === right\r\n if (!isPalendrome) break\r\n }\r\n\r\n return isPalendrome\r\n}\r\n\r\nfor (const string of strings) {\r\n console.log(\u0060${string} palendrome = ${checkPalendrome(string)}\u0060)\r\n}","IsDeferred":false},{"Name":"Reverse array comparison (long)","Code":"const strings = [\u0027tattarrattat\u0027, \u0027pneumonoultramicroscopicsilicovolcanoconiosis\u0027]\r\n\r\nconst checkPalendrome = string =\u003E {\r\n string === [...string].reverse().join(\u0027\u0027)\r\n}\r\n\r\nfor (const string of strings) {\r\n console.log(\u0060${string} palendrome = ${checkPalendrome(string)}\u0060)\r\n}","IsDeferred":false},{"Name":"For loop early exit (long)","Code":"const strings = [\u0027tattarrattat\u0027, \u0027pneumonoultramicroscopicsilicovolcanoconiosis\u0027]\r\n\r\nconst checkPalendrome = string =\u003E {\r\n const length = string.length\r\n let isPalendrome = true\r\n\r\n for (let index = 0; index \u003C= length; index\u002B\u002B) {\r\n const left = string.charAt(index)\r\n const right = string.charAt(length - index - 1)\r\n\r\n isPalendrome = left === right\r\n if (!isPalendrome) break\r\n }\r\n\r\n return isPalendrome\r\n}\r\n\r\nfor (const string of strings) {\r\n console.log(\u0060${string} palendrome = ${checkPalendrome(string)}\u0060)\r\n}","IsDeferred":false},{"Name":"Smallest solution (short)","Code":"const strings = [\u0027pop\u0027, \u0027noon\u0027, \u0027madam\u0027, \u0027james\u0027]\r\n\r\nconst checkPalendrome = string =\u003E string == string.split(\u0027\u0027).reverse().join(\u0027\u0027)\r\n\r\nfor (const string of strings) {\r\n console.log(\u0060${string} palendrome = ${checkPalendrome(string)}\u0060)\r\n}","IsDeferred":false},{"Name":"Smallest solution (long)","Code":"const strings = [\u0027tattarrattat\u0027, \u0027pneumonoultramicroscopicsilicovolcanoconiosis\u0027]\r\n\r\nconst checkPalendrome = string =\u003E string == string.split(\u0027\u0027).reverse().join(\u0027\u0027)\r\n\r\nfor (const string of strings) {\r\n console.log(\u0060${string} palendrome = ${checkPalendrome(string)}\u0060)\r\n}","IsDeferred":false}]}