How do I get the value of arguments in the repalce callback function?

javascript:repalce (regEx,Fn) how to get the value of arguments in the callback function Fn ()

sources of topics and their own ideas

an example in the extension of regular expression in Chapter 5 of Ruan Yifeng"s introduction to ES6, runtime error.

related codes

let re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/u;
//replace
prn("2015-01-02".replace(re, (matched, //  2015-01-02
    capture1, //  2015
    capture2, //  01
    capture3, //  02
    position, //  0
    S, //  2015-01-02
    groups //  {year, month, day}
    ) => { 
        let {year, month, day} = arguments[arguments.length - 1]; //
        //let {year, month, day}  = groups; //OK
        return `${day}/${month}/${year}`;
    }));

what result do you expect? What is the error message actually seen?

arguments [arguments.length-1] debugging observation, it is valuable and correct, but can not be assigned, too strange?
ask for advice, thank you!
(it"s OK to assign values directly with groups, needless to say. )


Arrow function without its own arguments, is just like not having its own this. You have a layer of functions nested here. Arguments is actually the arguments, of the outer function, so you don't find it. If you use str.replce (re,function () {}), there will be no problem

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38770-e666.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38770-e666.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?