1. var obj = {
    2. name:"javascript",
    3. sayName(){
    4. console.log(this.name)
    5. },
    6. wait(){
    7. // console.log(this.name);
    8. setTimeout(function(){
    9. console.log(this.name)
    10. })
    11. },
    12. delay(){
    13. setTimeout(()=>{
    14. console.log(this.name);
    15. })
    16. },
    17. layOut(){
    18. setTimeout(function(){
    19. console.log(this.name)
    20. }.bind(this))
    21. },
    22. print(){
    23. var that = this;
    24. setTimeout(function(){
    25. console.log(this.name)
    26. }.bind(that))
    27. }
    28. }
    29. obj.sayName(); //javascript
    30. obj.wait(); //window
    31. obj.delay(); //javascript
    32. obj.layOut(); //javascript
    33. obj.print() //javascript