How can I pass arguments to anonymous functions in JavaScript?

前端 未结 10 1426
别那么骄傲
别那么骄傲 2020-12-08 01:37

I\'m trying to figure out how to pass arguments to an anonymous function in JavaScript.

Check out this sample code and I think you will see what I mean:



        
10条回答
  •  既然无缘
    2020-12-08 02:23

    
    
    
    

    This works in my test suite which includes everything from IE6+. The anonymous function is aware of the object which it belongs to therefore you can pass data with the object that's calling it ( in this case myButton ).

提交回复
热议问题