hw12_04_check_02.html 443 B

12345678910111213141516171819
  1. <header>Check result</header>
  2. <body>
  3. <script>
  4. function checkResult(original, validator) {
  5. function wrapper(...params) {
  6. let result = null;
  7. while (validator(result = original(...params)) != true);
  8. return result;
  9. }
  10. return wrapper;
  11. }
  12. const alwaysSayYes = checkResult(confirm, x => x);
  13. alwaysSayYes();
  14. </script>
  15. </body>