caller,英文:来访者。 简单的说就是谁打电话给我,谁在调用我。
    callee,英文:被访者。简单的说就是接电话的人,就是正在执行的函数。

    caller 返回一个函数的引用,该函数调用了当前的函数,如果没有则返回null。
    callee 返回当前函数的引用

    1. function foo(){
    2. bar();
    3. console.log("Print Foo's callee ==>");
    4. console.log(arguments.callee);
    5. }
    6. function bar(){
    7. console.log("Print Bar's caller ==>");
    8. console.log(bar.caller);
    9. }
    10. foo();

    在执行foo函数时
    对于bar函数来说caller就是foo函数,callee就是bar函数
    对于foo函数来说caller就是null,callee就是foo函数
    image.png

    如下所示

    1. document.write(payload);

    对于writer来说,callee的名字就是write,caller的名字就是document

    1. window.location.hash.substr(1)

    对于hash来说,callee的名字就是hash,caller的名字就是window.location