About some sentence problems in Date.js

Date.getParseFunction = function (fx) {
    var fn = Date.Grammar.formats(fx);
    return function (s) {
        var r = null;
        try {
            r = fn.call({}, s);
        } catch (e) {
            return null;
        }
        return ((r[1].length === 0) ? r[0] : null);
    };
};
Date.parseExact = function (s, fx) {
    return Date.getParseFunction(fx)(s);
};

excuse me:

1.function (s, fx){} //sfx
2.fn.call({}, s);//
3.return ((r[1].length === 0) ? r[0] : null);//   

I would also like to trouble you for an answer. Thank you very much

Jun.29,2021

is there any great god who can answer


  • function (s, fx) {} / / fx, s is getParseFunction and the parameters it needs to return anonymous functions
  • fn.call ({}, s) / / indicates that this points to this empty object in fn , and s is the parameter required by fn
  • .
  • if you don't understand this, you must understand
    if((r[1].length === 0)) {
      return r[0]
    }
    
    return null
Menu