Advertisement
Guest User

Untitled

a guest
Jun 7th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getType(f) {
  2.         function TypeWrapper(arg) {
  3.             var type = {}.toString.call(arg).slice(8, -1);  ///// ???????????????????????????
  4.             return f.call(this, arg);
  5.         }
  6.  
  7.         return TypeWrapper;
  8.     }
  9.  
  10.     function formatDate(date) {
  11.         alert(TypeWrapper.type); ///// ???????????????????????????
  12.     }
  13.  
  14.     formatDate = getType(formatDate);
  15.  
  16.     formatDate('2011-10-02'); // 02.10.11
  17.     formatDate(1234567890); // 14.02.09
  18.     formatDate([2014, 0, 1]); // 01.01.14
  19.     formatDate(new Date(2014, 0, 1)); // 01.01.14
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement