{"ScriptPreparationCode":null,"TestCases":[{"Name":"Recursion","Code":"const getOutside = (el, expr) =\u003E {\r\n return el \u0026\u0026 (expr) ? el : (el !== document) ? getOutside(el.parentNode, expr) : null;\r\n}\r\nvar target = document.getElementById(\u0022parent4\u0022);\r\nvar test = getOutside(target, target.dataset.test);","IsDeferred":false},{"Name":"Loop","Code":"const getOutside = (el, expr) =\u003E {\r\n // Traverse the DOM up with a while loop\r\n while (!expr) {\r\n // Increment the loop to the parent node\r\n el = el.parentNode;\r\n if (!el) {\r\n return null;\r\n }\r\n }\r\n // At this point, the while loop has stopped and \u0060el\u0060 represents the element that has\r\n // the class you specified in the second parameter of the function \u0060clazz\u0060\r\n\r\n // Then return the matched element\r\n return el;\r\n}\r\nvar target = document.getElementById(\u0022parent4\u0022);\r\nvar test = getOutside(target, target.dataset.test);","IsDeferred":false}]}