{"ScriptPreparationCode":"function getRandomColor() {\r\n const letras = \u00220123456789ABCDEF\u0022;\r\n let color = \u0022#\u0022;\r\n for (let i = 0; i \u003C 6; i\u002B\u002B) {\r\n color \u002B= letras[Math.floor(Math.random() * 16)];\r\n }\r\n return color;\r\n}","TestCases":[{"Name":"Substr","Code":"function getContrast(hexcolor) {\r\n const red = parseInt(hexcolor.substr(1, 2), 16);\r\n const green = parseInt(hexcolor.substr(3, 2), 16);\r\n const blue = parseInt(hexcolor.substr(5, 2), 16);\r\n const luminance = (0.2126 * red \u002B 0.7152 * green \u002B 0.0722 * blue) / 255;\r\n return luminance \u003E 0.5 ? \u0022black\u0022 : \u0022white\u0022;\r\n}\r\nconst color= getRandomColor();\r\nconst textColor = getContrast(color);","IsDeferred":false},{"Name":"Substring","Code":"function getContrast(hexcolor) {\r\n const red = parseInt(hexcolor.substring(1, 2), 16);\r\n const green = parseInt(hexcolor.substring(3, 2), 16);\r\n const blue = parseInt(hexcolor.substring(5, 2), 16);\r\n const luminance = (0.2126 * red \u002B 0.7152 * green \u002B 0.0722 * blue) / 255;\r\n return luminance \u003E 0.5 ? \u0022black\u0022 : \u0022white\u0022;\r\n}\r\nconst color= getRandomColor();\r\nconst textColor = getContrast(color);","IsDeferred":false},{"Name":"Slice","Code":"function getContrast(hexcolor) {\r\n const red = parseInt(hexcolor.slice(1, 2), 16);\r\n const green = parseInt(hexcolor.slice(3, 2), 16);\r\n const blue = parseInt(hexcolor.slice(5, 2), 16);\r\n const luminance = (0.2126 * red \u002B 0.7152 * green \u002B 0.0722 * blue) / 255;\r\n return luminance \u003E 0.5 ? \u0022black\u0022 : \u0022white\u0022;\r\n}\r\nconst color= getRandomColor();\r\nconst textColor = getContrast(color);","IsDeferred":false}]}